in reply to Re^11: how to change process & thread priority on Win32 ?
in thread how to change process & thread priority on Win32 ?
I get error 24 (incorrect length) on Process32First.$pid = 952; # 952 is a running job pid use threads; use threads::shared; use Win32::API; Win32::API->Import( 'Kernel32', q[ DWORD GetLastError( ) ] ); $retcode = Win32::API->Import( 'Kernel32', q[ HANDLE CreateToolhelp32Snapshot ( DWORD dwFlags, DWORD th32ProcessID ) ] ); print "import CreateToolhelp32Snapshot code $retcode \n"; $hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); $retcode = GetLastError(); print "CreateToolhelp32Snapshot error code $retcode \n"; print "hProcessSnap = $hProcessSnap \n"; # typedef for PROCESSENTRY32 typedef Win32::API::Struct AA => qw{ DWORD dwSize; DWORD cntUsage; DWORD th32ProcessID; ULONG_PTR th32DefaultHeapID; DWORD th32ModuleID; DWORD cntThreads; DWORD th32ParentProcessID; LONG pcPriClassBase; DWORD dwFlags; TCHAR szExeFile[MAX_PATH]; }; $retcode = Win32::API->Import( 'Kernel32', q[BOOL Process32First( + HANDLE hSnapshot, LPAA lppe ) ] ); print "import process32first code $retcode \n"; $Point = Win32::API::Struct->new( 'AA' ); $Point->{dwSize}=Win32::API::Struct::sizeof( $Point ); Process32First($hProcessSnap, $Point); $retcode = GetLastError(); print "process32first error $retcode \n"; $retcode = Win32::API->Import( 'Kernel32', q[BOOL Process32Next( + HANDLE hSnapshot, LPAA lppe ) ] ); print "import process32next code $retcode \n"; until ( $Point->th32OwnerProcessID == $pid ) { Process32Next($hProcessSnap, $Point); $retcode = GetLastError(); print "process32next error code $retcode \n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^13: how to change process & thread priority on Win32 ?
by BrowserUk (Patriarch) on Dec 12, 2005 at 23:38 UTC | |
by rbutcher (Beadle) on Dec 13, 2005 at 05:26 UTC | |
by BrowserUk (Patriarch) on Dec 13, 2005 at 05:48 UTC | |
by rbutcher (Beadle) on Dec 16, 2005 at 00:13 UTC | |
by BrowserUk (Patriarch) on Dec 16, 2005 at 13:58 UTC |