Dailog Tutorials?

This is a discussion on Dailog Tutorials? within the Windows Programming forums, part of the Platform Specific Boards category; Well in my quest to learn Win32, i am going to expand in the realm of dialogs. I was hoping ...

  1. #1
    #junkie
    Join Date
    Oct 2004
    Posts
    240

    Dailog Tutorials?

    Well in my quest to learn Win32, i am going to expand in the realm of dialogs.

    I was hoping someone had some good dialog resources, showing many examples.
    MSDN helps to an extent, but when i dont know exactly what to do MSDN is mostly just confusing. I'v got a decent grasp of win32, and the standard windows, now i am desiring to learn about Dialog more extensivly and widely then i can find.

    Examples i would be looking for are such as:
    1.) Creating a Dialog as the main window,
    2.) Creating multiple dialogs for multiple options, similar to Winamps multiple windows,

    And many examples of Styles and other stuff along that line.

    Thanks to any replies! In regards to #1, i was able to do it but aparently i am missing some main system closer because when i close it, windows (or more specifically dev c++, so i assume windows saw it, i forgot to look ) see's it as still running. Even though i closed the dialog aparently i never sent a main windows closing procedure message?


    Anyway, thanks!
    01110111011000010110110001100100011011110010000001 11000101110101011010010111010000100000011011000110 10010110011001100101001000000111100101101111011101 0100100000011011100111010101100010

  2. #2
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    http://winprog.org/tutorials

    Read the stuff on dialogs there and MSND should seem like heaven.

    And as to your first question, there are two main ways to use a dialog as your main window. The first is as follows.

    Code:
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdShow, int nCmdShow)
     {
      return DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(dialog ID), NULL, dialog's procedure);
     }
    Very basic. As soon as your dialog closes, out application ends. personally, I prefer the other way, since I have had problems with giving the program an icon using this method. The other is this.
    Code:
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdShow, int nCmdShow)
     {
      MSG Msg;
    
      DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(dialog ID), NULL, dialog's procedure);
    
      while(GetMessage(&Msg, NULL, 0, 0))
       {
        TranslateMessage(&Msg);
        DispatchMessage(&Msg);
       }
    
      return Msg.wParam;
     }
    My guess is that you are using this method, but not doing this next step. You MUST have this next case in your Dialog's procedure.
    Code:
    case WM_CLOSE:
     {
      EndDialog(hwnd, 0);
      PostQuitMessage(0);
     }
    break;
    It's the PostQuitMessage line that actually ends your entire program. Without this, your dialog closes, but your program is still running, doing nothing. In fact, if you are using Windows XP, you can press Ctrl+Alt+Delete and click on the Processes tab and you'll be able to find your program listed there. You can end it from there, but otherwise, it will keep on running until it recieves a QuitMessage, which will never happen if you don't put it in your code.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 04-06-2007, 05:10 PM
  2. Why don't the tutorials on this site work on my computer?
    By jsrig88 in forum C++ Programming
    Replies: 3
    Last Post: 05-15-2006, 10:39 PM
  3. Wiki for Tutorials
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 08-16-2005, 03:03 PM
  4. CProgramming.com should update their tutorials.
    By PorkyChop in forum C++ Programming
    Replies: 17
    Last Post: 09-19-2004, 10:51 PM
  5. Best way to organize tutorials
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 05-30-2004, 04:41 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21