#define PROCESS_SET_INFORMATION 0x200 #define IDLE_PRIORITY_CLASS 0x40 declare integer OpenProcess in kernel32 integer lnaccess, integer lninherit, integer inprocID declare integer GetLastError in win32api declare integer SetPriorityClass in kernel32 integer, integer declare integer CloseHandle in kernel32 integer local lnhproc lnhproc = OpenProcess(PROCESS_SET_INFORMATION,0,lnprocID) if lnhproc = 0 ; or SetPriorityClass(lnhproc,IDLE_PRIORITY_CLASS) = 0 then ? GetLastError() endif CloseHandle(lnhproc)For SetPriorityClass to work, you must pass in a process handle, not a thread handle. You need to use the OpenProcess function and because you are going to be setting information about the process, pass in the PROCESS_SET_INFORMATION flag.
lnhthread = OpenThread(BITOR(THREAD_SET_INFORMATION,THREAD_QUERY_INFORMATION),0,lnthreadID) && give me write acces to set information and read access so I can verify my writes (if you don't believe the return value ;-)HTH.