Knowing that super search is my friend, I found this node that addresses this very issue.
So I go and download the appropriate DLL referenced in the article and looking at the documentation for Win32::API to import functions from DLLs and come up with the following code:
Where the DLL is in the same dir as the script, in windows/system, windows/system32, etc...use Win32::API; my $idleTrackerInitHandle = Win32::API->new( "C:\\Perl\\dvl\\itunes\\IdleTrac.dll", "int IdleTrackerInit()" ); my $result = $idleTrackerInitHandle->Call(); #my $idleTrackerInitHandle = Win32::API->new( # "IdleTrac", "int IdleTrackerInit()" # ); #my $result = $idleTrackerInitHandle->Call(); #$function = Win32::API->new( # 'IdleTrac, 'int idleTrackerInitHandle-()', # ); # $return = $function->Call();
And the result I get is always: Can't call method "Call" on an undefined value at C:\Perl\dvl\itunes\GetIdleTime.pl line 6, <DATA> line 164.
I have never tried importing functions from a DLL before but when I tried the samples on the Win32::API doc pages, those worked fine. I tried the above code and a bunch more (passing parameters, etc) but cannot get it to work.
Does anyone know what I am doing wrong?
Many thanks,
mdog
In reply to Get idle time on a Windows box by mdog
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |