Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Metal Typhoon

Dialog boxes question

This topic is 5923 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

it includes Menu.h which is
      
#define MENU_OPEN 11
#define MENU_SAVE 12
#define MENU_EXIT 13

#define OPTION_BACKGROUND 21

#define ABOUT 3
#define ABOUT_OK 31
  
My Window procedure is here
  
LRESULT CALLBACK WndProc(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam)
{
	switch(Msg)
	{
		case WM_CREATE:
			{
				HMENU Menu,SubMenu;
		
				Menu = CreateMenu();

				SubMenu = CreatePopupMenu();
				AppendMenu(Menu,MF_STRING|MF_POPUP,(UINT) SubMenu,"&File");
				AppendMenu(SubMenu,MF_STRING,MENU_OPEN,"O&pen");
				AppendMenu(SubMenu,MF_STRING,MENU_SAVE,"S&ave");
				AppendMenu(SubMenu,MF_STRING,MENU_EXIT,"E&xit");
			
				SubMenu = CreatePopupMenu();
				AppendMenu(Menu,MF_STRING|MF_POPUP,(UINT) SubMenu,"&Options");
				AppendMenu(SubMenu,MF_STRING,OPTION_BACKGROUND,"Background");

				SubMenu = CreatePopupMenu();
				AppendMenu(Menu,MF_STRING|MF_POPUP,(UINT) SubMenu,"&About");

				SetMenu(hWnd,Menu);
			}
		break;

		case WM_COMMAND:
			{
				switch(LOWORD(wParam))
				{
					case MENU_EXIT:
						if(MessageBox(NULL,"Are you sure you want to leave ?","Closing ...",MB_YESNO) == IDYES)
							DestroyWindow(hWnd);
					break;

					case ABOUT:
						{
							//HELP !

				}
			}
		break;

		case WM_CLOSE:
			if(MessageBox(NULL,"Are you sure you want to leave ?","Closing ...",MB_YESNO) == IDYES)
				DestroyWindow(hWnd);
		break;

		case WM_DESTROY:
			PostQuitMessage(0);
		break;

		default :
		    return DefWindowProc(hWnd,Msg,wParam,lParam);
		break;
	}

	return 0;
}
   
My dialog Procedure is here
      
bool CALLBACK DlgProc(HWDN hWnd,UINT Msg,WPARAM wParam,LPARAM lParam)
{
	switch(Msg)
	{
		case WM_INITDIALOG:
			return true;
		break;

		case WM_COMMAND :
			{
				switch(LOWORD(WPARAM))
				{
					case ABOUT_OK:
						EndDialog(hWnd,ABOUT_OK);
					break;
				}
			}

		default :
			return false;
		break;
	}

	return true;
}
    
My question is what kind of variable i use to creat dialogs ?? like for menu is use HMENU for icon HICON and etc... if there's another way please help me out. thx [edited by - Metal Typhoon on May 31, 2002 1:38:13 AM]

Share this post


Link to post
Share on other sites
Advertisement
It sounds like you''ve got the dialog described in the rsrc.rc file, which is the first step.

If you call CreateDialog(), you''ll get a non-modal dialog box (and you''ll have a HWND for it). This may not be what you want. To create a modal dialog box, there''s DialogBox(). To display, say, the IDD_MyDialog resource, you''d use something like this:

DialogBox(GetModuleHandle(0), MAKEINTRESOURCE(IDD_MyDialog), hWnd, DlgProc);

Share this post


Link to post
Share on other sites
i''m not using resources. like i did with the menu can i do it with the dialog ?? just creat it there ?? will CreateDialog work ?? is threr such variable called HDIALOG ? and one more question how would i define the Caption for it an font and other stuff of the dialog ?? thx alot

Share this post


Link to post
Share on other sites
There is no HDIALOG handle, but you can make your own window using CreateWindow() or CreateWindowEx() if you dont want to use a resource.



I will not make a list of links... I will not make a list of links... I will not make a list of links...
Invader''s Realm

Share this post


Link to post
Share on other sites
I''m pretty sure you can do that with DialogBoxIndirect(), but I''ve never used that before. I''ll play with it and see if I can get it to work.

Share this post


Link to post
Share on other sites
quote:
Original post by Beer Hunter
I''ve played with DialogBoxIndirect(). Merely declaring the data to pass to it is a disaster. I strongly suggest using resources


LMAO. let me try to see what i get

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!