Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting the windows 2000 process priority
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00601173
Message ID:
00601963
Views:
35
>>>>Does anyone know how to set the priority of a process in windows 2000 programatically from VFP?
>>>
>>>Hi Eylon,
>>>
>>>Take a look at Message #527632 for some ideas.
>>
>>Hello Sergey - I did - thanks. Still - this is for a VFP 6 app and I need a way to get the windows handle from the form.
>>
>You can use FindWindow to get window handle. See API #12638.

I wrote something like this:


DECLARE INTEGER GetWindowThreadProcessId IN user32 INTEGER, INTEGER@
DECLARE INTEGER FindWindow IN Win32API;
STRING @lpClassName, ;
STRING @lpWindowName
declare integer OpenThread in kernel32 integer lnaccess, integer lninherit, integer inthreadID
declare integer CloseHandle in kernel32 integer
#DEFINE THREAD_BASE_PRIORITY_MIN -2
#DEFINE THREAD_PRIORITY_HIGHEST 2
#DEFINE THREAD_PRIORITY_LOWEST THREAD_BASE_PRIORITY_MIN
#define THREAD_SET_INFORMATION 0x20
DECLARE SHORT SetThreadPriority in kernel32 INTEGER hThread, INTEGER nPriority
DECLARE SHORT GetThreadPriority in kernel32 INTEGER hThread
lcApplicationTitle = _screen.caption
lnHWnd = FindWindow(0, @lcApplicationTitle)
local lnprocID, lnthreadID
lnprocID = 1
lnthread_ID = GetWindowThreadProcessId(lnHWnd, @lnprocID)
local lnhthread
lnhthread = OpenThread(THREAD_SET_INFORMATION,0,lnThread_ID)
xx=getThreadPriority(lnhthread)
yy=SetThreadPriority(lnhthread, THREAD_PRIORITY_HIGHEST)
aa=getThreadPriority(lnhthread)
=CloseHandle(lnhthread)


Everything seems to work fine except that the priority remains unchanged - I checked xx and aa before and after, and yy gave 1, meaning success.

Any Ideas???

TIA, Eylon
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform