Posted by Richard1963 on November 25, 2008
Hello i have made an idle timer
wich counts until the mouse is moved and then resets the counter to zero.
Til so far no problem, but i want to use ShowCursor(false) and ShowCursor(True) to hide and show the mouse pointer when the mouse is not moved.
i am a beginner. please help
this is my code
function SecondsIdle: DWord; var liInfo: TLastInputInfo; begin liInfo.cbSize := SizeOf(TLastInputInfo) ; GetLastInputInfo(liInfo) ; Result := (GetTickCount - liInfo.dwTime) DIV 1000 end; procedure TfrmJukebox.Timer1Timer(Sender: TObject); begin If Button2.Caption > '20' Then begin {als de teller ongelijk 0 is ZET cursor UIT} Button2.Caption := Format('%d', [SecondsIdle]); Button1.Caption := ' muis UIT ' ; ShowCursor(false); end else begin { if movement mouse on} Button2.Caption := Format('%d', [SecondsIdle]); Button1.Caption := ' muis AAN ' ; ShowCursor(True) end end;
it doesnt work like it should
looks like randomly on and of or is it simply to slow?
Related articles