Solved

SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_HIGHEST)

Posted on 2009-04-09
3
1,201 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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with preventing selection from a combobox 11 41
Need syntax help building hyperlink 2 40
Problem to Office 1 43
Visual C# Windows Project - Clone Form 4 21
A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

749 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