LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use "GetLastInputInfo" in "user32.dll"

      Hi,
 
I need to logout user if he doesn't make action during 5 minutes, "GetLastInputInfo" method in the "user32.dll" library, return the tick of the last action, so I can know the inactivity time of the login user.
 
But I try to using "Call Dll function" item in Labview 8.1, and each time I run VI, Labview crash.
 
Next, is information about the method :
 
DLL
###############################
User32.dll
 
Syntax
###############################
BOOL GetLastInputInfo(PLASTINPUTINFO plii);
 
Parameters
###############################
plii : [out] Pointer to a LASTINPUTINFO structure that receives the time of the last input event.
Private Type LASTINPUTINFO
    cbSize As Long
    dwTime As Long
End Type

Return Value
###############################
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
 
Remarks
###############################
This function is useful for input idle detection. However, GetLastInputInfo does not provide system-wide user input information across all running sessions. Rather, GetLastInputInfo provides session-specific user input information for only the session that invoked the function.
 
You can see also my VI source.
 
0 Kudos
Message 1 of 7
(7,858 Views)
Change your calling convention to "WINAPI". You have to use this calling convention when calling Windows API functions.

Note: Depending on how you have it set up you may be able to just use an Event Structure's Timeout event.
0 Kudos
Message 2 of 7
(7,855 Views)
Oki for WINAPI, but it doesn't work anyway, Can you explain me what is an "Event Structure's Timeout event". Maybe you can make a little sample. Thanls.
0 Kudos
Message 3 of 7
(7,843 Views)
Hi SebBourgeois,
now it works, see the attachment.
Mike
0 Kudos
Message 4 of 7
(7,832 Views)

When you place an Event Structure on the BD, by default it ll show the Timeout event. Smiley Happy

If you rt-click on the ES border & tell Edit Events handled by this case..., you can see that this Timeout event is owned by the application itself, not by any individual control/indicator present on the FP of teh VI [Application].

- Partha ( CLD until Oct 2027 🙂 )
Message 5 of 7
(7,830 Views)
Thanks a lot, now I know how to get a Cluster size wich is my real trouble.
0 Kudos
Message 6 of 7
(7,824 Views)

Use the All Objects[] or teh Controls[] property of the cluster to get that array of all the controls/indicators inside a cluster & wire this to the Array Size function to get the size of the cluster. Smiley Happy

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 7 of 7
(7,815 Views)