#include #include "resource.h" //定数 #define ID_TIMER 100 //プロトタイプ宣言 LRESULT CALLBACK DlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp); //////////////////エントリーポイント////////////////////////////////////////// int WINAPI WinMain(HINSTANCE hCurInst, HINSTANCE hPrevInst,LPSTR lpsCmdLine, int nCmdShow) { DialogBox(hCurInst, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)DlgProc); return 0; } //////////////////ダイアログプロシージャ/////////////////////////////////// LRESULT CALLBACK DlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { static DWORD dwCount = 0; POINT point; switch (msg) { case WM_INITDIALOG: SetWindowPos(hWnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE); return TRUE; case WM_COMMAND: switch (LOWORD(wp)) { case IDOK: SetTimer(hWnd, ID_TIMER, 60, NULL); dwCount = ::GetTickCount(); break; case IDCANCEL: KillTimer(hWnd, ID_TIMER); PostMessage(hWnd, WM_CLOSE, 0, 0); break; } return 0; case WM_TIMER: if(GetTickCount()-dwCount < 3*1000) return 0; ::GetCursorPos(&point); if(point.x==0 && point.y==0) { KillTimer(hWnd, ID_TIMER); return 0; } mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0 ,0 ,0, 0); return 0; case WM_CLOSE: EndDialog(hWnd, IDOK); break; } return FALSE; }