|
|||
|
Hi,
I want to track "user activity" on a windows system in order to know if he is active or away from the pc. (like in messenger) A good way to do this would be to track mouse movement and reset a timer when the mouse is not moving. I thought about Application.captureMouse but I don't see how to use this in Flex 3. Any hints? tnx, Gert |
|
|||
|
I found a solution (workaround?) for myself:
struct { long x; long y; } POINT; dllimport "user32.dll" stdcall Boolean GetCursorPos(POINT*); function traceWin() { var output = new Object; output.value = new Struct(POINT); GetCursorPos(output); //var hwnd = WindowFromPoint(output.value); trace(output.value.x); } Application.setInterval(traceWin, 1000); Checking the x and y values for changes will let me know if the user is away or not. Probably not the most elegant way of doing this: any other hints are very welcome. Gert |
|
|||
|
Thank you SWFKit: this is indeed a much better solution.
I love your support: this is *the* reason why our company sticks with SWFKit (despite its outdated looking IDE and scripting environment) ![]() |
|
|||
|
Hm, I was a little bit too fast ... I can not make this work:
here's my ffish code, but output is "0 - 0" ... ![]() struct { long cbSize; //uint ~ long ? long dwTime; //dword ~ long ? } LASTINPUTINFO; dllimport "user32.dll" stdcall Boolean GetLastInputInfo(LASTINPUTINFO*); function pollLastInputInfo() { var lastInput = {cbSize:32, dwTime:0}; //is 32 the right size? lastInput.value = new Struct(LASTINPUTINFO); GetLastInputInfo(lastInput); trace(lastInput.value.cbSize + " - " + lastInput.value.dwTime); } Application.setInterval(pollLastInputInfo, 1000); |
|
|||
|
Code:
struct {
long cbSize; //uint ~ long ?
long dwTime; //dword ~ long ?
} LASTINPUTINFO;
dllimport "user32.dll" stdcall Boolean GetLastInputInfo(LASTINPUTINFO*);
function pollLastInputInfo() {
var lastInput = new Object;
lastInput.value = new Struct(LASTINPUTINFO);
lastInput.value.cbSize = lastInput.value.structSize;
GetLastInputInfo(lastInput);
trace(lastInput.value.cbSize + " - " + lastInput.value.dwTime);
}
Application.setInterval(pollLastInputInfo, 1000);
|
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|