Click to See Complete Forum and Search --> : Windoze
Is it possible to increase the priority windoze gives to my program so that the it doesn't put more priority on it's lunch and other little programs than mine.
This problem is noticeable when you try and create a clock it'll jump 2 or 3 seconds no matter what the timer says because it's having a nap instead of updating my clock!
------------------
Matthew Ralston
E-Mail: matthew@ralston.net
ICQ: 31422892
Web Site: My Home Page (http://www.matthew.ralston.net) (Not up yet!!)
Sorry about my English, but my Scouse is dead good!
MartinLiss
Jan 25th, 2000, 11:46 AM
With a timer interval set to 100, it works just fine for me. If you are doing anything else besides just displaying the time as text, try putting a DoEvents statement in your loop (if any) or other (no pun intended)time consuming code.
------------------
Marty
Why is it called lipstick if you can still move your lips?
The clock bit was just an example really...my question really goes deeper than that..
As far as I know, Windows, or the Processor, or something has like a hierarchy of how important tasks that the computer needs to carry out really are.
I.E.
In Dr Solomons AVTK doing the startup scan in more important than refreshing the screen. (It looks terrible when it first launches if you have dragged another program over it, but it still does the scan.
Get the idea? How to I pursuade Windows that my program is more important than it really is...so it gets attention faster...?
------------------
Matthew Ralston
E-Mail: matthew@ralston.net
ICQ: 31422892
Web Site: My Home Page (http://www.matthew.ralston.net)
Sorry about my English, but my Scouse is dead good!
bhogg
Jan 25th, 2000, 06:51 PM
Windows has many different priority levels, but even with these set, another program could share the same level and take your processing power away. Nothing's guaranteed. Real time is only recommended for a very short period of time, under controlled circumstances.
Anyway, now for the code :)
Declarations section of a module:
Public Const HIGH_PRIORITY_CLASS = &H80
Public Const REALTIME_PRIORITY_CLASS = &H100
Public Const NORMAL_PRIORITY_CLASS = &H20
Public Const IDLE_PRIORITY_CLASS = &H40
Public Declare Function SetPriorityClass Lib "kernel32" (ByVal hProcess As Long, ByVal dwPriorityClass As Long) As Long
You can then use a functions to do the job, such as:
Public Sub SetHighPriority()
Dim hProc As Long, i As Long
hProc = GetCurrentProcess()
i = SetPriorityClass(hProc, HIGH_PRIORITY_CLASS)
End Sub
Enjoy!
Brian
-------------
Brian Hogg
webmaster@drawbingo.com
The more you play, the more you win! at: http://www.drawbingo.com/
Thank you!! That's exactly what I was after!
Thank you!! :) :D
------------------
Matthew Ralston
E-Mail: matthew@ralston.net
ICQ: 31422892
Web Site: My Home Page (http://www.matthew.ralston.net)
Sorry about my English, but my Scouse is dead good!
[This message has been edited by matthewralston (edited 01-26-2000).]
What is GetCurrentProcess()?
You haven't defined it in the above code.
------------------
Matthew Ralston
E-Mail: matthew@ralston.net
ICQ: 31422892
Web Site: My Home Page (http://www.matthew.ralston.net)
AKA: ...::: The Fragmeinster :::... (On Quake 3 World Forums (http://www.quake3world.com/forums/))
Sorry about my English, but my Scouse is dead good!
Found it!! The API viewer shows it as:
Public Declare Function GetCurrentProcess Lib "kernel32" Alias "GetCurrentProcess" () As Long
I just stick it underneith the SetPriorityClass declaration in the code above? That right?
------------------
Matthew Ralston
E-Mail: matthew@ralston.net
ICQ: 31422892
Web Site: My Home Page (http://www.matthew.ralston.net)
AKA: ...::: The Fragmeinster :::... (On Quake 3 World Forums (http://www.quake3world.com/forums/))
Sorry about my English, but my Scouse is dead good!
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.