Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
HHOOK hKBHook = SetWindowsHookEx(WH_KEYBOARD,&KBHookProc, NULL, 0);
HHOOK kMouseHook = SetWindowsHookEx(WH_MOUSE,&MouseHookProc, NULL, 0);
//Timer starten (mit SetTimer)
LRESULT CALLBACK KBHookProc(UINT code, WPARAM wParam, LPARAM lParam)
(
//Wird aufgerufen, wenn eine Taste gedrückt wurde -> Timer zurücksetzen
CallNextHookEx(hKBHook, code, wParam, lParam); //<- WICHTIG!
)
LRESULT CALLBACK MouseHookProc(UINT code, WPARAM wParam, LPARAM lParam)
(
//Wird aufgerufen, wenn ein Mausevent auftrat ->Timer zurücksetzen
CallNextHookEx(hKBHook, code, wParam, lParam); //<- WICHTIG!
)
LRESULT CALLBACK TimerProc(HWND hWnd, UINT uMsg, UINT idEvent, DWORD dwTime)
(
//System herunterfahren
)
int main()
{
POINT pos,newpos;
double time=clock();
while(1)
{
GetCursorPos(&pos);
Sleep(10000);
GetCursorPos(&newpos);
if(kbhit() || (pos.x!=newpos.x && pos.y!=newpos.y)) time=clock();
printf("%d %d %d %d\n",pos.x,pos.y,newpos.x,newpos.y);
if(clock()-time >= 60000)printf("\n\n-------------shutdown-------------\n\n");
}
}