Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

I'm new to C++, help!


  • Please log in to reply
3 replies to this topic

#1 lozu

lozu

  • Members
  • 29 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:08:25 PM

Posted 15 July 2010 - 04:49 AM

As you now C++ are really useful to create programs. I reckon most of the Microsoft Programs use something like C++, but their own version of it.
Anyway, I was creating a basic text editor and I want a 'menu item' or 'button', when is clicked show a dialog (not a message box).
Any easy way of rocking it, thanks.

BC AdBot (Login to Remove)

 


#2 Romeo29

Romeo29

    Learning To Bleep


  • Members
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:04:25 AM

Posted 17 July 2010 - 04:19 PM

What are you using with C++ to create the Text Editor ? Are you using pure Windows API? or some framework like MFC, .NET etc or other third party library. ?

In pure Windows API, you have to create a Dialog resource and then create the dialog using CreateDialog(). You have to define the callback DLGPROC function for taking care of Dialog messages.

For detailed information see this : http://msdn.microsoft.com/en-us/library/ms...28VS.85%29.aspx

#3 unixunited

unixunited

  • Members
  • 3 posts
  • OFFLINE
  •  
  • Local time:04:25 AM

Posted 31 July 2010 - 10:22 PM

You can use a resource(.rc) file and create the menu like so:
http://www.winprog.org/tutorial/menus.html

Then create the dialog in the same resource file:
http://www.winprog.org/tutorial/dialogs.html

So when you want to show the dialog if the menu item is clicked, it would look like this:
// ...in the main window procedure
case WM_COMMAND: 
	switch(LOWORD(wParam))
	{
		case IDR_MENU_ITEM: // the menu item ID
			DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG), hwnd, DialogProc);
			break;

		default:
			break;
	}
	return 0;


#4 lozu

lozu
  • Topic Starter

  • Members
  • 29 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:08:25 PM

Posted 13 August 2010 - 05:49 AM

You can use a resource(.rc) file and create the menu like so:
http://www.winprog.org/tutorial/menus.html

Then create the dialog in the same resource file:
http://www.winprog.org/tutorial/dialogs.html

So when you want to show the dialog if the menu item is clicked, it would look like this:

// ...in the main window procedure
case WM_COMMAND: 
	switch(LOWORD(wParam))
	{
		case IDR_MENU_ITEM: // the menu item ID
			DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG), hwnd, DialogProc);
			break;

		default:
			break;
	}
	return 0;

Thanks, how would i link to a dialog box i saw 'MAKEINTRESOURCE(IDD_DIALOG)' is 'IDD_DIALOG' a name that defines the new dialog box.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users