Solved

SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_HIGHEST)

Posted on 2009-04-09
3
1,220 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

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

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

717 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