Menu

Loading a Dialog Box

2007-11-10
2012-09-26
  • Martian Man

    Martian Man - 2007-11-10

    Hello,
    I want to load a dialog box when a menuitem is clicked, I've got the code for a dialog box in a resource file using the DIALOGEX stuff and the name of my dialog box is IDD_ADD. Can someone please give me the code here in this format:

    case IDM_MENUITEM:
    //How to load the dialog box.
    break; or return 0; //Whichever one it is, idk.

    Thank you!!!

     
    • BiT

      BiT - 2007-11-13

      hmmmm did you even do a search before you came posting here????? Try to help yourself next time as this one of the more frequent tutorials out on the web.

      the result of a search..

      http://winprog.org/tutorial/

       
    • Osito

      Osito - 2007-11-10

      I haven't used this, but here is some sample code I got from a website that I've been meaning to play around with:

      hDlg=DialogBox(hInst, MAKEINTRESOURCE(IDD_ADD), hwnd, (DLGPROC)MyProc);
      EndDialog(hDlg, nResult);

      Then you would have:
      INT_PTR CALLBACK MyProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
      for you procedure.

      You can look up those functions on MSDN for all the details.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.