📄 apptest.cpp
字号:
// AppTest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <windows.h>
#include <conio.h>
int main()
{
HANDLE hDevice =
CreateFile("\\\\.\\TestDevice",
GENERIC_READ | GENERIC_WRITE,
0, // share mode none
NULL, // no security
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL ); // no template
if (hDevice == INVALID_HANDLE_VALUE)
{
printf("设备打开失败!\n");
return 1;
}
printf("设备打开成功!\n");
printf("Press any key to continue....\n");
getch();
printf("关闭设备!\n");
CloseHandle(hDevice);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -