PeekMessage Windows XP

This is a discussion on PeekMessage Windows XP within the C++ Programming forums, part of the General Programming Boards category; 2 Q's in one : What is the best ( also what is the easiest ) way to stop openGL ...

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    14

    PeekMessage Windows XP

    2 Q's in one : What is the best ( also what is the easiest ) way to stop openGL hogging all the CPU time yet still keeping
    millisecond control over what is happening.

    e.g.
    update screen and check messages every 40 milliseconds

    various delay loops I have seen - which ones pass control back to windows (tutorial wasn't clear)
    and is threading better (i will have to learn loads for that).

    Any advice would be great. No code needed.

    to AndyHunter - sorry about hijacking other thread and I see your point about the int main(void) - I thought it was just good practice.

  2. #2
    Handy Andy andyhunter's Avatar
    Join Date
    Dec 2004
    Posts
    540
    Do a search on this board for game loop. You will get what you need. Also on top of the game forum there are sticky's with very useful links to game development websites.
    i don't think most standard compilers support programmers with more than 4 red boxes - Misplaced

    It is my sacred duity to stand in the path of the flood of ignorance and blatant stupidity... - quzah

    Such pointless tricks ceased to be interesting or useful when we came down from the trees and started using higher level languages. - Salem

  3. #3
    Registered User
    Join Date
    Feb 2005
    Posts
    14
    thank you

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    >update screen and check messages every 40 milliseconds
    Have you tried:
    Code:
    Sleep(40); //Sleep 40 msec

  5. #5
    Registered User
    Join Date
    Feb 2005
    Posts
    14
    will do
    thanks

  6. #6
    Handy Andy andyhunter's Avatar
    Join Date
    Dec 2004
    Posts
    540
    >way to stop openGL hogging all the CPU time<

    >Sleep(40); //Sleep 40 msec<

    Absolutely not. This is not the solution you are looking for here.
    i don't think most standard compilers support programmers with more than 4 red boxes - Misplaced

    It is my sacred duity to stand in the path of the flood of ignorance and blatant stupidity... - quzah

    Such pointless tricks ceased to be interesting or useful when we came down from the trees and started using higher level languages. - Salem

  7. #7
    Registered User
    Join Date
    Feb 2005
    Posts
    14
    You are probably not going to like it but I have given up on trying to stop openGL hogging all the CPU time. Its complicated but because I also need to accept user input I have just inserted timeGetTime() statements and compared them with each other.
    Looking around best solution is to make WM_TIMER send message to the window and use getMessage instead of PeekMessage. I will expect to be totally wrong on this though.
    Its been a long week learning C++ syntax.
    Next week back to university where they want us to use MFC. Joy! Microsoft gets to tell me what to do for the next 3 months.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program works on Windows XP and 2000, not on 98 or ME
    By MidnightlyCoder in forum C++ Programming
    Replies: 7
    Last Post: 03-10-2006, 03:36 PM
  2. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  3. Windows XP (and Vista) shiney look and feel
    By lightatdawn in forum A Brief History of Cprogramming.com
    Replies: 25
    Last Post: 09-18-2005, 03:56 PM
  4. Help coding in Windows XP
    By zoanoid13 in forum Windows Programming
    Replies: 1
    Last Post: 02-24-2003, 09:07 PM
  5. windows xp and aol (im's)
    By rickc77 in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 10-26-2001, 07:50 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21