Thread: Creating pop up menus

  1. #1
    Registered User
    Join Date
    Jan 2004
    Posts
    68

    Creating pop up menus

    Hi,

    I am using windows API to draw an OPEN GL scene like the nehe tutorials and how do I create pop up menus I want to create pop up menus to make it able to change color of object in my world.

    Thx.
    -Ti22-

  2. #2
    Handy Andy andyhunter's Avatar
    Join Date
    Dec 2004
    Posts
    540
    You guys really need to search the board prior to posting, and this does belong in the windows forum. Alas,

    Code:
    #include <windows.h>
    
    //Just some definitions that we will use later on to 
    //create the popup menu
    #define IDM_WHITE	4001
    #define IDM_LTGRAY	4002
    #define IDM_GRAY	4003
    #define IDM_DKGRAY	4004
    #define IDM_BLACK	4005
    
    LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
    
    
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) {
    
    	HWND hwnd;
    	MSG msg;
    	WNDCLASS wc;
    	TCHAR szAppName[] = TEXT("PopMenu");
    
    	wc.cbClsExtra = 0;
    	wc.cbWndExtra = 0;
    	wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
    	wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    	wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    	wc.hInstance = hInstance;
    	wc.lpfnWndProc = WndProc;
    	wc.lpszClassName = szAppName;
    	wc.lpszMenuName = NULL;
    	wc.style = CS_HREDRAW | CS_VREDRAW;
    
    	if(!RegisterClass(&wc)) {
    		MessageBox(NULL, TEXT("Could not register class"), szAppName, MB_ICONERROR);
    		return 0;
    	}
    
    	hwnd = CreateWindow(szAppName, TEXT("Popup Menu Demo"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
    						CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
    
    	ShowWindow(hwnd, iCmdShow);
    	UpdateWindow(hwnd);
    
    	while(GetMessage(&msg, NULL, 0, 0)) {
    		
    		TranslateMessage(&msg);
    		DispatchMessage(&msg);
    	}
    
    	return msg.wParam;
    }
    LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
    
    	static HMENU hMenu;
    	static int idColor[5] = {WHITE_BRUSH, LTGRAY_BRUSH, GRAY_BRUSH, DKGRAY_BRUSH, BLACK_BRUSH };
    	static int iSelection = IDM_WHITE;
    	POINT point;
    
    	switch(message) {
    
    		case WM_CREATE:
    
    			//All this does is creates the menu dynamically. I did this so I wouldn't have to worry about uploading a resource
    			//script. It performs the same function. Note for a resource script you will have to explicitley say it is a 
    			//popup menu.
    			hMenu = CreatePopupMenu();
    
    			AppendMenu(hMenu, MF_STRING, IDM_WHITE, "White");
    			AppendMenu(hMenu, MF_STRING, IDM_LTGRAY, "Light Gray");
    			AppendMenu(hMenu, MF_STRING, IDM_GRAY, "Gray");
    			AppendMenu(hMenu, MF_STRING, IDM_DKGRAY, "Dark Gray");
    			AppendMenu(hMenu, MF_STRING, IDM_BLACK, "Black");
    
    			return 0;
    		case WM_RBUTTONUP:
    
    			//The popupmenu will be displayed when the user right clicks so for this example I chose to track it with the 
    			//right button up message
    			
    			point.x = LOWORD(lParam); // fugure out where the mouse was when the user clicked
    			point.y = HIWORD(lParam); //
    			
    			ClientToScreen(hwnd, &point); //conver those coordinates into screen coordinates (relative -> absolute)
    
    			TrackPopupMenu(hMenu, TPM_RIGHTBUTTON, point.x , point.y ,0, hwnd, NULL); //Display the popup menu and inform
    			//windows we want to track the right mouse button. 
    
    			return 0;
    		case WM_COMMAND:
    
    			switch(LOWORD(wParam)) {
    
    				case IDM_WHITE:
    				case IDM_LTGRAY:
    				case IDM_GRAY:
    				case IDM_DKGRAY:
    				case IDM_BLACK:
    
    					//This is just some menu handling logic that checks the menu item and then redraws the background.
    					//Nothing really unique here.
    					CheckMenuItem(hMenu, iSelection, MF_UNCHECKED);
    					iSelection = LOWORD(wParam);
    					CheckMenuItem(hMenu, iSelection, MF_CHECKED);
    
    					SetClassLong(hwnd, GCL_HBRBACKGROUND, (LONG)GetStockObject(idColor[(LOWORD(wParam) - IDM_WHITE)]));
    					InvalidateRect(hwnd, NULL, TRUE);
    					return 0;
    			}
    			break;
    		case WM_DESTROY:
    
    			DestroyMenu(hMenu);
    			PostQuitMessage(0);
    			return 0;
    	}
    	return DefWindowProc(hwnd, message, wParam, lParam);
    }
    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
    Never Exist Hermitsky's Avatar
    Join Date
    Jul 2004
    Posts
    149
    well, i think make a resource file is a better way, we can write everything like menu,dialogbox,controls in it.

    resource.h :
    Code:
    #if !defined(resource_H)
    #define resource_H
    #endif
    
    #define BMS_MENU                    102
    
    #define ID_FILE_SAVE                413
    #define ID_FILE_LOAD                412
    #define ID_FILE_EXIT                411
    
    #define ID_BOOK_LEND                421
    #define ID_BOOK_RETURN              422
    #define ID_BOOK_ADD                 423
    #define ID_BOOK_EDIT                 424
    #define ID_BOOK_REMOVE              425
    
    #define ID_LIST_ALL                 431
    #define ID_LIST_TITLE               432
    #define ID_LIST_PUBLISHER           433
    #define ID_LIST_TYPE                434
    
    
    #define ID_SEARCH                   441
    
    #define ID_TOOLS_NOTEPAD            451
    
    #define ID_HELP_ABOUT               461
    resource.rc :
    Code:
    #include"resource.h"
    #include<windows.h>
    
    BMS_MENU MENU DISCARDABLE
    BEGIN
        POPUP "&File"
        BEGIN
            MENUITEM "&Load"            ID_FILE_LOAD
            MENUITEM "&Save"          ID_FILE_SAVE
            MENUITEM SEPARATOR
            MENUITEM "&Exit"                       ID_FILE_EXIT
        END
        POPUP "&Book"
        BEGIN
            MENUITEM "&Lend"                      ID_BOOK_LEND
            MENUITEM "&Return"                       ID_BOOK_RETURN
            MENUITEM SEPARATOR
            MENUITEM "&Add"                       ID_BOOK_ADD
            MENUITEM "&Edit"                        ID_BOOK_EDIT
            MENUITEM "Re&move"                       ID_BOOK_REMOVE
        END
        POPUP "&Search"
        BEGIN
            MENUITEM "&Search ..."      ID_SEARCH
        END
        POPUP "&List"
        BEGIN
            POPUP "&Sort ..."
            BEGIN
                  MENUITEM "By &Title"          ID_LIST_TITLE
                  MENUITEM "BY &Publisher"        ID_LIST_PUBLISHER
                  MENUITEM "By T&ype"       ID_LIST_TYPE
            END
            MENUITEM SEPARATOR
            MENUITEM "List &All"              ID_LIST_ALL
        END
        POPUP "&Tools"
        BEGIN
            MENUITEM "&Notepad"      ID_TOOLS_NOTEPAD
        END
        POPUP "&Help"
        BEGIN
            MENUITEM "&About BMS"      ID_HELP_ABOUT
        END
    END

    and when we do windows class registration(as andyhunter's code), we load the resource into our program:
    Code:
    wc.lpszMenuName = BMS_MENU;

    blow me ... ...

  4. #4
    Handy Andy andyhunter's Avatar
    Join Date
    Dec 2004
    Posts
    540
    Quote:

    All this does is creates the menu dynamically. I did this so I wouldn't have to worry about uploading a resource
    script.
    It performs the same function. Note for a resource script you will have to explicitley say it is a popup menu.
    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

  5. #5
    Never Exist Hermitsky's Avatar
    Join Date
    Jul 2004
    Posts
    149
    creates the menu dynamically is only needed when we have to do some change on menu while the program is running.
    and use .rc we can handle all the resource freely.

    blow me ... ...

  6. #6
    Handy Andy andyhunter's Avatar
    Join Date
    Dec 2004
    Posts
    540
    I meant to this board.
    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
    Handy Andy andyhunter's Avatar
    Join Date
    Dec 2004
    Posts
    540
    Creating pop up menus 01-17-2005 12:10 PM
    Please don't provide lots of code with little or no explanation

    ?????????

    WTH is this suppose to be? >Lots of code<, last I checked the only thing I left uncommented was making the window. Which based on the question and context I'm sure Ti22 knew how to do that.

    edit - this is from my usercp thing btw.
    Last edited by andyhunter; 01-17-2005 at 12:16 PM.
    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

  8. #8
    Registered User
    Join Date
    Jan 2004
    Posts
    68
    k I got the menu working and everything

    here is my code so far
    Code:
    case WM_COMMAND:
    			{
    					
    				switch(LOWORD(wParam))
    				{
    					case ID_COUCHCOLOR_RED:
    						{
    							couchR = 1.0;
    							couchG = 0.0;
    							couchB = 0.0;
    							
    						}
    					case ID_COUCHCOLOR_WHITE:
    						{
    							couchR = 1.0;
    							couchG = 1.0;
    							couchB = 1.0;
    						}
    					case ID_COUCHCOLOR_BLUE:
    						{
    							couchR = 0.0;
    							couchG = 0.0;
    							couchB = 1.0;
    						}
    				}
    
    			}
    the problem now is it won't apply the IE when I click on red it won't apply red it just applies teh ID_COUCHCOLOR_BLUE

    however If I remove the 2 cases WHITE and BLUE then I get red why is this?

    it just applies the latest color to the object.

    anyway I can fix this?
    -Ti22-

  9. #9
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    WTH is this suppose to be? >Lots of code<, last I checked the only thing I left uncommented was making the window. Which based on the question and context I'm sure Ti22 knew how to do that.
    My aplogies. There used to be a lot of posters who would quote tonnes of code from elsewhere without even checking if it was relevant, and it became a real pet peeve of mine, so I just assumed. Sorry. Rep++.

  10. #10
    Handy Andy andyhunter's Avatar
    Join Date
    Dec 2004
    Posts
    540
    You've forgot the break statements to exit out of your switch, aka

    Code:
    switch(LOWORD(wParam)) {
                 
                      case ID_COUCHCOLOR_RED:
                      {
    							                   couchR = 1.0;
    		   couchG = 0.0;
    		   couchB = 0.0;
    		   break; //<-----------add this after each case					
    	  }
    You'll need to add that for each case statement. Or return, however you have your program setup.
    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

  11. #11
    Registered User
    Join Date
    Jan 2004
    Posts
    68
    cool thx

    its working like a charm now .


    Thx.
    -Ti22-

  12. #12
    Registered User
    Join Date
    Jan 2004
    Posts
    68
    hmm I've ran into another problem, its pretty minor though

    after a certain number of clicks my pop up menu won't work anymore

    any idea how to fix this?
    -Ti22-

  13. #13
    Handy Andy andyhunter's Avatar
    Join Date
    Dec 2004
    Posts
    540
    I am going to need you to post some more code to answer that question.
    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

  14. #14
    Registered User
    Join Date
    Jan 2004
    Posts
    68
    here is my winmain

    Code:
    int WINAPI WinMain (HINSTANCE hInstance,
    					HINSTANCE hPrevInstance,
    					LPSTR	lpCmdLine,
    					int		nCmdShow)
    {
    	MSG		msg;
    	bool	done = false;
    
    	//The next part will be a message box that pops up to ask the user if he/she wishes to run in
    	//Fullscreen mode.
    	if(MessageBox(NULL, "Would you like to run in Full Screen Mode", "Ti-X Engine", MB_YESNO | MB_ICONQUESTION)==IDNO)
    	{
    		fullscreen = false;			//runs in windowed mode (since the fullscreen way up there has been set to true by default)
    	}
    
    	//This is where we create the OpenGL window (using the creat_gl_window function we wrote earlier)
    	if(!create_gl_window("Ti-X WGL Skeleton", 1280, 1024, 16, fullscreen))
    	{
    		return 0;			//Quit if the window was not able to creat
    	}
    
    	while (!done)			//While we're not done continue in the while loop (this is actually our main loop)
    	{
    		if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
    		{
    			if (msg.message==WM_QUIT)			//If recieve a message telling to quit then set done to true
    			{	
    				done = true;				//This will make the program quit
    			}
    			else					//if we're not done then handle the messages.
    			{
    				TranslateMessage(&msg);		//Translate message
    				DispatchMessage(&msg);		//Dispatch messate
    			}
    		}
    		else
    		{
    			if(program_status)
    			{
    				if (keys[VK_ESCAPE])		//If the escape key is pressed
    				{
    					done = true;			//Done to true, so we quit
    				}
    				else					//if not then continue drawing our stuff.
    				{
    					draw_scene(); //here we finally call the draw_scene function which will draw our stuff
    					SwapBuffers(hDC); //Since we're using double buffering we need this to swap the buffer
    					if (keys['L'] && !l_stat)
    					{
    						l_stat = true;
    						light = !light;
    
    						if (!light)
    						{
    							glDisable(GL_LIGHTING);
    						}
    						else
    						{
    							glEnable(GL_LIGHTING);
    						}
    					}
    					if (!keys['L'])
    					{
    						l_stat = false;
    					}
    					if (keys['W'])
    					{
    						camera_x -= (float)sin(-mouse_y * piover180) * 0.05f;
    						camera_z -= (float)cos(-mouse_y * piover180) * 0.05f;
    					}
    					if (keys['S'])
    					{
    						camera_x += (float)sin(-mouse_y * piover180) * 0.05f;
    						camera_z += (float)cos(-mouse_y * piover180) * 0.05f;
    					}
    					if (keys['A'])
    					{
    						camera_x -= (float)cos(mouse_y * piover180) * 0.05f;
    						camera_z -= (float)sin(mouse_y * piover180) * 0.05f;
    					}
    					if (keys['D'])
    					{
    						camera_x += (float)cos(mouse_y * piover180) * 0.05f;
    						camera_z += (float)sin(mouse_y * piover180) * 0.05f;
    					}
    					if (keys[VK_LEFT])
    					{
    						direction += 0.02f;
    						rotate_z = direction;
    					}
    					if (keys[VK_RIGHT])
    					{
    						direction -= 0.02f;
    						rotate_z = direction;
    					}
    					if (keys[VK_PRIOR])
    					{
    						height += 0.01f;
    					}
    					if (keys[VK_NEXT])
    					{
    						height -= 0.01f;
    					}
    					
    					
    				}
    			}
    			//This next bit of code will alow you to switch from windowed to fullscreen mode.
    			if(keys[VK_F1])
    			{
    				keys[VK_F1] = false;  // If f1 is pressed make false 
    				kill_gl_window();
    				fullscreen = !fullscreen;
    				// Recreate our GL window
    				if (!create_gl_window("Ti-x WGL Framework", 1280, 1024, 16, fullscreen))
    				{
    					return 0;
    				}
    			}
    		}
    	}
    	//shut down	
    	kill_gl_window();		//Kill window
    	return(msg.wParam);		//Exit the program
    
    
    }
    here is my WndProc

    Code:
    //this callback function will handle the message out put by window.
    LRESULT CALLBACK WndProc( HWND hWnd,
    						  UINT uMsg,
    						  WPARAM wParam,
    						  LPARAM lParam)
    {
    	static HMENU hMenu;
    	//POINT point;
    	
    	
    	switch(uMsg)			//This will check for all sorts of windows message.
    	{
    		case WM_MOUSEMOVE:
    			{
    				mouse_y = LOWORD(lParam);
    				mouse_x = HIWORD(lParam);
    			}
    		case WM_INITDIALOG:
    			{	
    				hMenu = LoadMenu(GetModuleHandle(NULL),//Load Menu
    				MAKEINTRESOURCE(IDR_MENU2));
    				hMenu = GetSubMenu(hMenu,0);//Get Sub Menu
    				return 0;
    			}
    		case WM_RBUTTONDOWN:
    			{
    				//point.x = LOWORD(lParam);
    				//point.y = HIWORD(lParam);
    				TrackPopupMenu(hMenu,TPM_LEFTALIGN | TPM_RIGHTBUTTON,
    				mouse_y,mouse_x,NULL,hWnd,NULL);
    				return 0;
    			}
    				
    				
    		case WM_COMMAND:
    			{
    
    				switch(LOWORD(wParam))
    				{
    					case ID_COUCHCOLOR_RED:
    						{
    							couchRGB[0] = 1.0;
    							couchRGB[1] = 0.0;
    							couchRGB[2] = 0.0;
    							return 0;
    						}
    					case ID_COUCHCOLOR_WHITE:
    						{
    							couchRGB[0] = 1.0;
    							couchRGB[1] = 1.0;
    							couchRGB[2] = 1.0;
    							return 0;
    						}
    					case ID_COUCHCOLOR_BLUE:
    						{
    							couchRGB[0] = 0.0;
    							couchRGB[1] = 0.0;
    							couchRGB[2] = 1.0;
    							return 0;
    						}
    
    					case ID_TVCOLOR_GREEN:
    						{
    							tv_setRGB[0] = 0.0;
    							tv_setRGB[1] = 1.0;
    							tv_setRGB[2] = 0.0;
    							return 0;
    						}
    					case ID_TVCOLOR_RED:
    						{
    							tv_setRGB[0] = 1.0;
    							tv_setRGB[1] = 0.0;
    							tv_setRGB[2] = 0.0;
    							return 0;
    						}
    					case ID_TVCOLOR_YELLOW:
    						{
    							tv_setRGB[0] = 0.7;
    							tv_setRGB[1] = 0.5;
    							tv_setRGB[2] = 0.0;
    							return 0;
    						}
    					case ID_TVSTANDCOLOR_WHITE:
    						{
    							tv_standRGB[0] = 1.0;
    							tv_standRGB[1] = 1.0;
    							tv_standRGB[2] = 1.0;
    							return 0;
    						}
    					case ID_TVSTANDCOLOR_RED:
    						{
    							tv_standRGB[0] = 1.0;
    							tv_standRGB[1] = 0.0;
    							tv_standRGB[2] = 0.0;
    							return 0;
    						}
    					case ID_TVSTANDCOLOR_GREY:
    						{
    							tv_standRGB[0] = 0.2;
    							tv_standRGB[1] = 0.2;
    							tv_standRGB[2] = 0.2;
    							return 0;
    						}
    					case ID_TEATABLECOLOR_GREY:
    						{
    							tea_tableRGB[0] = 0.0;
    							tea_tableRGB[1] = 1.0;
    							tea_tableRGB[2] = 0.0;
    							return 0;
    						}
    					case ID_TEATABLECOLOR_BLUE:
    						{
    							tea_tableRGB[0] = 0.1;
    							tea_tableRGB[1] = 0.1;
    							tea_tableRGB[2] = 1.0;
    							return 0;
    						}
    					case ID_TEATABLECOLOR_BROWN:
    						{
    							tea_tableRGB[0] = 0.07;
    							tea_tableRGB[1] = 0.037;
    							tea_tableRGB[2] = 0.007;
    							return 0;
    						}
    					case ID_ROOMCOLOR_RED:
    						{
    							wallRGB[0] = 0.6;
    							wallRGB[1] = 0.1;
    							wallRGB[2] = 0.0;
    							return 0;
    						}
    					case ID_ROOMCOLOR_WHITE:
    						{
    							wallRGB[0] = 1.0;
    							wallRGB[1] = 1.0;
    							wallRGB[2] = 1.0;
    							return 0;
    						}
    					case ID_ROOMCOLOR_GREEN:
    						{
    							wallRGB[0] = 0.0;
    							wallRGB[1] = 1.0;
    							wallRGB[2] = 0.0;
    							return 0;
    						}
    					case ID_PICTUREFRAMECOLOR_WHITE:
    						{
    							picture_frameRGB[0] = 1.0;
    							picture_frameRGB[1] = 1.0;
    							picture_frameRGB[2] = 1.0;
    							return 0;
    						}
    					case ID_PICTUREFRAMECOLOR_RED:
    						{
    							picture_frameRGB[0] = 1.0;
    							picture_frameRGB[1] = 0.0;
    							picture_frameRGB[2] = 0.0;
    							return 0;
    						}
    					case ID_PICTUREFRAMECOLOR_GREEN:
    						{
    							picture_frameRGB[0] = 0.0;
    							picture_frameRGB[1] = 1.0;
    							picture_frameRGB[2] = 0.0;
    							return 0;
    						}
    					case ID_WINDOWFRAMECOLOR_RED:
    						{
    							windowRGB[0] = 1.0;
    							windowRGB[1] = 0.0;
    							windowRGB[2] = 0.0;
    							return 0;
    						}
    					case ID_WINDOWFRAMECOLOR_GREEN:
    						{
    							windowRGB[0] = 0.0;
    							windowRGB[1] = 1.0;
    							windowRGB[2] = 0.0;
    							return 0;
    						}
    					case ID_WINDOWFRAMECOLOR_ORANGE:
    						{
    							windowRGB[0] = 0.4;
    							windowRGB[1] = 0.3;
    							windowRGB[2] = 0.0;
    							return 0;
    						}
    					return 0;
    
    				}
    				return 0;
    			}
    		case WM_ACTIVATE:
    		{
    			if(!HIWORD(wParam))	//Check if Program is in Minimize state
    			{
    				program_status = true;				//Program is still active
    			}
    			else
    			{
    				program_status = false;				//Program is going into Minimize state
    			}
    			
    			return 0;
    		}
    		case WM_SYSCOMMAND:	
    		{
    			switch (wParam)
    			{
    				case SC_SCREENSAVE:			//In case that screensaver is trying to start
    				case SC_MONITORPOWER:		//In case that monitor going into power saving mode
    				return 0; //<< this will prevent the above from happening.
    			}
    			break;
    		}
    		case WM_CLOSE:			//If the X at the top right hand corner is pressed
    		{
    			DestroyMenu(hMenu);
    			EndDialog(hWnd,0);
    			PostQuitMessage(0);			//Post a Quit Message
    			return 0;					
    		}
    		case WM_KEYDOWN:		//If a key is being pressed
    		{
    			keys[wParam] = true;		//If a key is being pressed mark it as true
    			return 0;
    		}
    		case WM_KEYUP:			//If a key is released
    		{
    			keys[wParam] = false;		//If a key is released mark as false
    			return 0;
    		}
    		case WM_SIZE:			// If the Resize button is pressed
    		{
    			resize_window(LOWORD(lParam), HIWORD(lParam));		//LoWord = width HiWord = Height
    			return 0;
    		}
    		return 0;
    	}
    
    	//Of course there are more windows message we don't give a damn about so we can pass it through this:
    	return DefWindowProc(hWnd, uMsg, wParam, lParam);
    }
    -Ti22-

  15. #15
    Handy Andy andyhunter's Avatar
    Join Date
    Dec 2004
    Posts
    540
    Code:
    case WM_COMMAND:
    
                 switch(LOWORD(wParam))  {
                                         //your case statements
                 }
                 break; //<----------------instead of return 0;
    
    //other case statements
    try that out and let me know.
    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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating push & pop functions... decrementing/tracking?
    By Sparrowhawk in forum C Programming
    Replies: 22
    Last Post: 12-14-2008, 09:10 PM
  2. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  3. creating menus and other stuff
    By C+noob in forum Windows Programming
    Replies: 4
    Last Post: 07-13-2005, 07:20 PM
  4. Creating menus
    By firestorm in forum C++ Programming
    Replies: 13
    Last Post: 04-06-2005, 11:19 AM
  5. Creating menus
    By jr2007 in forum Windows Programming
    Replies: 4
    Last Post: 10-27-2003, 03:11 PM