[icq-devel] Input event, was(no subject)



ggr ggr at bak.rr.com
Tue Jan 7 07:47:27 CET 2003


Here is what I ended up doing:

I have a threaded timer that fires onec a second, here is the code it uses:
Seems to work great and in the performance monitor, I can't tell the difference 
from when I have ten copies runninvg and when I have none running.
Thanks to all that helped.

Gene

Function GetLastInputTick:DWord;
Var
  Lii:TMyInputInfo;
  mp:TPoint;
Begin
  If gIsNT then Begin
    // Post WinNT Code;
    Lii.cbSize := SizeOf(Lii);
    If MyLastInputInfo(lii)Then // Dynamic linked to GetLastInputInfo
      Result := lii.dwTime
    Else
      Result := 0;
  End Else Begin
    // Pre WinNT code;
    GetCursorPos(MP);
    If (mp.X <> savedMp.X) or (mp.Y <> SavedMP.y) Then Begin
      gLastInputTick := GetTickCount;
      gSavedMP.X := mp.X;
      gSavedMP.Y := mp.Y;
    End;
    Result := gLastInputTick;
  End;
End;

Procedure TfrmMain.tmrSecondTimer(Sender: TObject);
Var
 aStat: Cardinal;
 LastTick,tc:Dword;
begin
  If Not gIsOnline then Exit;
  LastTick := GetLastInputTick;
  If gIsAway Then
   If gSavedTick <> LastTick Then Begin
     gIsAway := False;
     ChangeMyStatus(fSavedStatus);
     Exit;
   End;
  aStat := GetMyStatus;  // Returns my current status
  If not(ChkStatus(aStat, S_ONLINE) or ChkStatus(aStat, S_FFC)) Then
    Exit; // Already away
  tc := GetTickCount;
  If (tc - LastTick) > (gAutoAwayCnt * 60000) Then Begin
    gIsAway := True;
    gSavedTick := LastTick;
    gSavedStatus := aStat;
    ChangeMyStatus(S_AWAY);
  End;
end;



1/6/2003 7:27:01 PM, Remy Lebeau <gambit47 at yahoo.com> wrote:

>You have to implement the hook in a DLL in order to
>capture events for the entire system.  Memory maps are
>just a convenient way to share memory across multiple
>instances of the DLL.
>
>
>Gambit
>
>--- ggr <ggr at bak.rr.com> wrote:
>
>> I have played with the SetWindowsHookEX, but
>> usless I want to add memory mapped files to it,
>> it only works when the mouse is over my window.
>> Do you have any suggextions?
>
>
>__________________________________________________
>Do you Yahoo!?
>Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
>http://mailplus.yahoo.com
>-------------------------------------------------
>icq-devel - The forum for ICQ protocol discussion
>For unsubscribe and other mailing list info, see:
>http://www.d.kth.se/~d95-mih/icq/icq-devel/
>
>





More information about the icq-devel mailing list