Solved

SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_HIGHEST)

Posted on 2009-04-09
3
1,189 Views
Last Modified: 2012-05-06
http://beta.experts-exchange.com/articles/Programming/Languages/.NET/Visual_Basic.NET/Upgrading-VB6-to-VB-NET-Performance-Improvements.html
Hi,
In the article mentioned above he has mentioned in doevents
 3.  Add 2 lines of code before the intensive processing begins to set the thread priority:

          SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_HIGHEST)
          SetPriorityClass(GetCurrentProcess, HIGH_PRIORITY_CLASS)  

Can you please inform me where do I add this?


SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_HIGHEST)
          SetPriorityClass(GetCurrentProcess, HIGH_PRIORITY_CLASS)

Open in new window

0
Comment
Question by:RIAS
  • 2
3 Comments
 
LVL 7

Expert Comment

by:HalfAsleep
ID: 24106720
Anywhere after createThread and before you start your thread processing/loop.
0
 

Author Comment

by:RIAS
ID: 24108288
How do i know which thread is the priority
0
 
LVL 7

Accepted Solution

by:
HalfAsleep earned 500 total points
ID: 24108784
You have to give a handle to a thread as a parameter, in your case, getCurrentThread is used to get the handle of the currently executing thread, so whatever thread is running that code, is the one that will get its priority changed. Is that what you asked for? I can have a look at the article later, but setting a thread priority that high is not that common, but then again, I have not read the article yet.
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question