I have little experience using DllCall and I am stuck with this DLL.
I want to extract idle info from CallNtPowerInformation, specifically the SystemPowerInformation structure.
That should give me a more accurate idle time compared to A_TimeIdle, considering that some cbt softwares as Skype, MS Teams and others can prevent the system to idle for example during a video conference, which is not considered inside A_TimeIdle (as it is based on GetLastInputInfo).
For some reasons I get an ErrorLevel -4
I am also not sure how to pass the enumeration parameter InformationLevel, I have tried it either as "Str", "SystemPowerInformation" or as "Uint" 12.
My code is:
Code: Select all
#NoEnv
SendMode Input
structSize:=4*3+1
VarSetCapacity(myStruct, structSize, 0)
returnValue:=DllCall("CallNtPowerInformation", "Str", "SystemPowerInformation", "Int", 0, "Uint", 0, "Ptr", &myStruct, "Uint", structSize)
msgbox, %ErrorLevel%
;Reference to DLL: https://docs.microsoft.com/en-us/windows/win32/api/powerbase/nf-powerbase-callntpowerinformation