Program slows down system

This is a discussion on Program slows down system within the Windows Programming forums, part of the Platform Specific Boards category; Hi you all, I've got a problem and I've tried everything to fix it, or even to see what is ...

  1. #1
    Mox
    Mox is offline
    Registered User
    Join Date
    Aug 2001
    Posts
    41

    Unhappy Program slows down system

    Hi you all,

    I've got a problem and I've tried everything to fix it, or even to see what is wrong. It's like this: the messages of the window are slow. Or for that matter, my whole program slows everything else down, including itself.
    It's really weird because I've made more programs like this one that work fine. I've tried them out just now and they still work.

    They are game (simple game) programs that for now just draw something. I use the following game loop:

    Code:
    	while (true)
    	{
    		if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
    		{
    			if (GetMessage(&msg, NULL, 0, 0))
    			{
    				TranslateMessage(&msg);
    				DispatchMessage(&msg);
    			}
    			else
    				break;
    		}
    		else
    			DoGame();
    	}
    I have this in both programs (one works, the other is slow). I use DirectX in both and blt in the same way in both. But one slows down the system and the other doesn't.
    What could be wrong here? (or do you know of anything that could cause this?)
    BTW if I do nothing in DoGame() the slow program works fine...

    (By slowing the system I mean, everything is slowed down, clicking, pressing a button (also ALT-F4), dragging the window, showing other windows, etc)

    Joren

  2. #2
    Mox
    Mox is offline
    Registered User
    Join Date
    Aug 2001
    Posts
    41
    Hi again,

    what I have to add, is that when I almost draw nothing in the app that did work, the same thing happens. I only clear the backbuffer and blt it to the screen. This doesn't take too long (a couple of microsecons or so ) so the framerate is sky high.
    Could this cause the system to slow down. Is the message loop traversed so fast that it can't get the messages or something? I would think that if the program doesn't do much in the DoGame() it would be good. But maybe because it only does DirectDraw things which stall the system (does it?), it can't get the messages?
    Should I therefor slow down the framerate? I wanted to keep it as high as possible...
    Or could something else be wrong???

    Joren

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 02:30 PM
  2. using system command results in a program
    By finnepower in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2005, 08:58 AM
  3. Date program starts DOS's date
    By jrahhali in forum C++ Programming
    Replies: 1
    Last Post: 11-24-2003, 04:23 PM
  4. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 11:39 AM

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