Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Visual Basic 2010 Programmer's Reference
This is the forum to discuss the Wrox book Visual Basic 2010 Programmer's Reference by Rod Stephens; ISBN: 9780470499832
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Visual Basic 2010 Programmer's Reference section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 22nd, 2013, 04:07 AM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default ProcessPriorityClass

Hi everybody,
in VB 2010, I need to set the priority level of a process to a level that will not be interrupted by the operating system (Windows 7).
Could anyone please tell me how that is done?
Thanks for you assistance.
Best regards - Walter
Reply With Quote
  #2 (permalink)  
Old February 23rd, 2013, 05:56 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,145, Level: 23
Points: 3,145, Level: 23 Points: 3,145, Level: 23 Points: 3,145, Level: 23
Activity: 50%
Activity: 50% Activity: 50% Activity: 50%
 
Join Date: Jan 2006
Location: , , .
Posts: 641
Thanks: 2
Thanked 96 Times in 95 Posts
Default

I'm not sure you can do that reasonably in Windows. Here's an example that lets you set a thread's priority:

http://www.vb-helper.com/howto_net_thread_priority.html

But Windows is a task switching operating system. If you can make a process non-interruptable, then nothing else on the system including the system itself would be able to do anything.

If you really need that, then you may need to use some other real-time operating system.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Reply With Quote
  #3 (permalink)  
Old February 24th, 2013, 04:40 AM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, Rod, for the info and the link.

VB in windows does provide a >ProcessPriorityClass.RealTime< - so maybe I can use that - being very careful to switch back to >ProcessPriorityClass.Normal< after the non-interruptable process is finished.

Don't you think that should work?

Take care - Walter
Reply With Quote
  #4 (permalink)  
Old February 24th, 2013, 09:56 AM
Rod Stephens's Avatar
Wrox Author
Points: 3,145, Level: 23
Points: 3,145, Level: 23 Points: 3,145, Level: 23 Points: 3,145, Level: 23
Activity: 50%
Activity: 50% Activity: 50% Activity: 50%
 
Join Date: Jan 2006
Location: , , .
Posts: 641
Thanks: 2
Thanked 96 Times in 95 Posts
Default

That sounds promising, although I've never tried it.

Post again to tell us all if it works for you.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Reply With Quote
  #5 (permalink)  
Old February 25th, 2013, 03:25 AM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Rod,

the >ProcessPriorityClass.RealTime< seems to be some kind of joke: when I try to set the priorityClass to >RealTime< and then interrogate the process, asking for the status of the PriorityClass it gives back the status >High<.

I don't know what to make of it ????

Take care - Walter
Reply With Quote
  #6 (permalink)  
Old February 25th, 2013, 10:49 AM
Rod Stephens's Avatar
Wrox Author
Points: 3,145, Level: 23
Points: 3,145, Level: 23 Points: 3,145, Level: 23 Points: 3,145, Level: 23
Activity: 50%
Activity: 50% Activity: 50% Activity: 50%
 
Join Date: Jan 2006
Location: , , .
Posts: 641
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Sorry, I don't have any experience with this. It could be that you don't have privileges to elevate to the highest level. You could try running the program with the "As Administrator" option to see if there's any difference.

The documentation says RealTime gives the program the highest possible priority. Perhaps the operating system won't let you go higher than High.

I used to know some people who needed real time control for things like data acquisition. They used a real time operating system not windows. But that was a long time ago.

Sorry I don't have any more insight for you.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off



All times are GMT -4. The time now is 08:07 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.