Greetings from Sydney, my first post here. I have written a Perl script to change thread priorities using Win32::API. I followed the online examples at MSDN for the API calls needed which are as follows (I've omitted the Imports) :-
CreateToolhelp32Snapshot
Process32First
Process32Next
Thread32First
OpenThread
SetThreadPriority

$hProcessSnap=CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD , 0);

I create the required PROCESSENTRY32 structure :-
Win32::API::Struct AA q{
DWORD dwSize;
  DWORD cntUsage;
  DWORD th32ProcessID;
  ULONG_PTR th32DefaultHeapID;
  DWORD th32ModuleID;
  DWORD cntThreads;
  DWORD th32ParentProcessID;
  LONG pcPriClassBase;
  DWORD dwFlags;
  TCHAR szExeFile[MAX_PATH];
};
$Point=Win32::API::Struct->new ('AA');

Process32First($hProcessSnap, $Point);

I then get error "Invalid Type 'M' in pack... at Struct.pm".
This appears to be happening at [MAX_PATH] because I don't get the error if I omit it or hardcode it to 1 e.g. [1]. But if I do then I then get error code 24 (incorrect length) in Process32First. Looks to me that Win32::API::Struct cannot handle an array size... any way round this ?
thanks
Rod
-----------------------------------------------------
<corporate disclaimer drivel goes here>
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to