Thread: Help, the window gets killed......

  1. #1
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427

    Help, Running of message loop.

    Ok, this is what I am trying to do, I am trying to make it so that every time you press the left mouse button of your mouse, the litttle space ship will fire something.........This is somewhat what I have.........


    This is how the message loop is organized......

    Code:
    	//message pump
    	for(;;)	
    	{
    		//look for a message
    		if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
    		{
    			//there is a message
    
    			//check that we arent quitting
    			if(msg.message==WM_QUIT) break;
    			
    			//translate message
    			TranslateMessage(&msg);
    
    			//dispatch message
    			DispatchMessage(&msg);
    		}
    
    		//run main game loop
    		
    		Prog_Loop();
    	}
    	
    	//clean up program data
    	Prog_Done();
    
    	//return the wparam from the WM_QUIT message
    	return(msg.wParam);
    So obviously we will be going through the message pump every time until the window's killed.......I have this on winproc.

    case WM_LBUTTONDOWN:
    {
    Fire();
    return (0);

    }break;


    This would call Fire which is a function outside of the Program loop and everthing. Well my problem is that when I press the mouse it goes to fire and then it stays there, it doesn't go back to the Prog_Loop or so it seems nothing it's updated......How can I make it so that I can press the mouse and then keep on going with the message loop any idea?
    I know I am doing something seriously wrong, thanks in advance.
    Last edited by incognito; 05-25-2002 at 11:32 PM.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    you haven't really given enough information. Can we at least see the contents of the Fire() function?

    It's probably better if post a link to your code so we can see the whole thing in action. If you windows program isn't behaving as it should, the problem could really be anywhere in your code!

    U.
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

  3. #3
    Unregistered
    Guest
    Why'd you put return (0) after Fire()??

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  2. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  3. My Window Class
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 07-10-2005, 02:33 PM
  4. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  5. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM