PC Review


Reply
Thread Tools Rate Thread

How to call GetPriorityClass,GetThreadPriority?

 
 
joeu2004
Guest
Posts: n/a
 
      17th Mar 2009
How can I call Get/SetPriorityClass and Get/SetThreadPriority?

At issue is the HANDLE parameter. I had hoped that I might get away
with passing a NULL pointer (ByVal 0), but it didn't work.

Public Declare Function GetPriorityClass Lib "kernel32" (ByRef pHandle
As Long) As Long
Public Declare Function GetThreadPriority Lib "kernel32" (ByRef
tHandle As Long) As Long

Private Sub getProcInfo()
Dim x As Long
x = GetPriorityClass(ByVal 0)
Debug.Print "GetPriorityClass= "; Hex(x)
x = GetThreadPriority(ByVal 0)
Debug.Print "GetThreadPriority= "; Hex(x)
End Sub
 
Reply With Quote
 
 
 
 
joeu2004
Guest
Posts: n/a
 
      17th Mar 2009
On Mar 16, 11:24*pm, Leith Ross <Leith.Ross.3p6...@thecodecage.com>
wrote:
> You have to pass in a valid handle to the function.
> Null will not default to the calling thread or class.


Okay. Aha! I just discovered GetCurrentProcess() and GetCurrentThread
(). I also realized that I should pass those pseudo-handles by value,
not by reference, to GetPriorityClass() and GetThreadPriority().

With those two fixes, things are working now.

Many thanks!
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call a javascript when i call an aspx page with a form html not running on server Fabio Mastria Microsoft ASP .NET 4 28th Jan 2008 09:05 AM
Warning 1684 CA2214 : Microsoft.Usage : 'RandomShade..ctor(Int32, Int32, Int32, Int32, Int32)' contains a call chain that results in a call to a virtual method defined by the class. Review the following call stack for unintended consequences: steve bull Microsoft C# .NET 4 7th Jul 2005 05:54 PM
Are we new users supposed to call this number? I have auto dial on my XP in the dialer but am I required to call? Windows XP New Users 12 26th May 2005 03:47 PM
GetPriorityClass in Win2003 Yaniv M Microsoft C# .NET 1 30th May 2004 04:23 PM
disable call waiting on a local call puts in area code JMB Windows XP Print / Fax 0 17th Feb 2004 10:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:03 PM.