110,539
社区成员
发帖
与我相关
我的任务
分享
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // command line
int nCmdShow // show state
)
{
//修改注册表,使开机运行
HKEY hKey;
char path[MAX_PATH];
GetModuleFileName(NULL,path,sizeof(path));
RegCreateKey(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",&hKey);
RegSetValueEx(hKey,"ShotScreen",0,REG_SZ,(CONST BYTE*)path,
sizeof(path));
RegCloseKey(hKey);
//获取窗口句柄,屏幕分辨率
HWND hwnd = GetDesktopWindow();
int cxScreen,cyScreen;
cxScreen = GetSystemMetrics(SM_CXFULLSCREEN);
cyScreen = GetSystemMetrics(SM_CYFULLSCREEN);
//获取"Time_to_Shot.txt"中保存的截屏时间间隔
HANDLE hFile = CreateFile("Time_to_Shot.txt",GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
char ch[10];
DWORD dwReads;
ReadFile(hFile,ch,10,&dwReads,NULL);
ch[dwReads] = 0;
CloseHandle(hFile);