Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to minimize window and set low priority through API?
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00527416
Message ID:
00528205
Views:
32
Thanks Larry, I got it working now!

Sure, I mix thread, process and other IDs and handles up, since I am doing this API stuff just for the second time, and in this particular case one of the functions is even called GetWindowThreadProcessId() :)))

And when I run the following piece for example, I get several different numbers:

LOCAL lnprocID, lnthreadID, lnhproc, lnhthread
lnprocID = 1
lnthreadID = GetWindowThreadProcessId(THISFORM.nSHWND, @lnprocID) && Returns 964
* lnprocID = 1236 at this point
lnhproc = OpenProcess(PROCESS_SET_INFORMATION,0,lnprocID) && Returns 364
LOCAL lnhthread
lnhthread = OpenThread(BITOR(THREAD_SET_INFORMATION,THREAD_QUERY_INFORMATION),0,lnthreadID) && Returns 400

Do I get it right, that if I set SetPriorityClass(lnhproc,IDLE_PRIORITY_CLASS) and see "Low" in Task Manager, I don't really need to use

SetThreadPriority(lnhthread, THREAD_PRIORITY_LOWEST) ?

However I may use it if I want to change thread priority within the previously set Process priority, or, for example, if there are 3 threads in the process and I want to change only one thread's priority. Right?

Thanks again for your help.


*
>Hi Nick,
>What is happening here is you are mixing threads and processes. Processes can have 1 or more thread associated with them while threads are singular entities.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform