// Clic_ici.c #define _WIN32_WINNT 0x0500 #include <windows.h> //--------------------------------------------------------- void CALLBACK TimerProc(HWND a, UINT b, UINT_PTR c, DWORD d) { // Simule un clic gauche la ou se trouve la souris INPUT i[2]; ZeroMemory(i, sizeof(i)); i[0].type = i[1].type = INPUT_MOUSE; i[0].mi.dwFlags = MOUSEEVENTF_LEFTDOWN; i[1].mi.dwFlags = MOUSEEVENTF_LEFTUP; SendInput(2, i, sizeof(INPUT)); MessageBeep(0); } //--------------------------------------------------------- int WINAPI WinMain(HINSTANCE a, HINSTANCE b, LPSTR c, int d) { MSG m; UINT_PTR t; // Une seule instance CreateMutex(0, 0, "Clic_ici"); if(GetLastError() == ERROR_ALREADY_EXISTS) return 1; // Toutes les minutes ... t = SetTimer(0, 1, 60000, TimerProc); // Ctrl + Alt + Q pour quitter RegisterHotKey(0, 1, MOD_CONTROL|MOD_ALT, 'Q'); while(GetMessage(&m, 0, 0, 0)) { DispatchMessage(&m); if(m.message == WM_HOTKEY) if(m.wParam == 1) break; } UnregisterHotKey(0, 1); KillTimer(0, t); return 0; }