Results 1 to 7 of 7

Thread: Windoze

  1. #1
    Guest

    Post

    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: [email protected]
    ICQ: 31422892
    Web Site: My Home Page (Not up yet!!)

    Sorry about my English, but my Scouse is dead good!

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    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?

  3. #3
    Guest

    Post

    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: [email protected]
    ICQ: 31422892
    Web Site: My Home Page

    Sorry about my English, but my Scouse is dead good!

  4. #4
    New Member
    Join Date
    Jan 1999
    Posts
    10

    Post

    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
    [email protected]

    The more you play, the more you win! at: http://www.drawbingo.com/


  5. #5
    Guest

    Post

    Thank you!! That's exactly what I was after!
    Thank you!!

    ------------------
    Matthew Ralston
    E-Mail: [email protected]
    ICQ: 31422892
    Web Site: My Home Page

    Sorry about my English, but my Scouse is dead good!


    [This message has been edited by matthewralston (edited 01-26-2000).]

  6. #6
    Guest

    Post

    What is GetCurrentProcess()?
    You haven't defined it in the above code.

    ------------------
    Matthew Ralston
    E-Mail: [email protected]
    ICQ: 31422892
    Web Site: My Home Page
    AKA: ...::: The Fragmeinster :::... (On Quake 3 World Forums)

    Sorry about my English, but my Scouse is dead good!

  7. #7
    Guest

    Post

    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: [email protected]
    ICQ: 31422892
    Web Site: My Home Page
    AKA: ...::: The Fragmeinster :::... (On Quake 3 World Forums)

    Sorry about my English, but my Scouse is dead good!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width