Help for this page

Select Code to Download


  1. or download this
        HANDLE         hProcessSnap = NULL; 
        BOOL           bRet      = FALSE; 
    ...
            printError();
        }
        CloseHandle(hThread);
    
  2. or download this
    $pid = 952;
    # 952 is a running job pid
    ...
         q[ HANDLE  CreateToolhelp32Snapshot( DWORD dwFlags,  DWORD th32Pr
    +ocessID ) ] );
    $hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, $pid);    
    +  
    print "hProcessSnap = $hProcessSnap \n";
    
  3. or download this
    Win32::API->Import( 'Kernel32', 
         q[ BOOL Thread32First(  HANDLE hSnapshot, THREADENTRY32 lpte)] );
    $retcode = GetLastError();
    print "import threadfirst error was $retcode \n";
    
  4. or download this
    # typedef for THREADENTRY32
    typedef Win32::API::Struct AA => qw{
    ...
    Thread32First($hProcessSnap, LPAA);
    $retcode = GetLastError();
    print "threadfirst error was $retcode \n";
    
  5. or download this
    Win32::API->Import( 'Kernel32', q[HANDLE OpenThread( DWORD dwDesiredAc
    +cess, BOOL bInheritHandle, DWORD dwThreadId) ] );
    
    ...
    Win32::API->Import( 'Kernel32', q[ BOOL SetThreadPriority( HANDLE hThr
    +ead, int nPriority ) ] );
    
    SetThreadPriority( hThread, $threadpriority );