I got this to compile, but it's not popping my Dialog box.
The tutorial from www.winprog.org/tutorial didnt necessarily specify where my AboutDlgProc() is suppose to go ?
I assumed it went above the Default but I am unsure... I'm trying to understand why it's not popping my Aboout Dialog when I press HELP -> ABOUT

#include <windows.h>


#define ID_FILE_EXIT 9001
#define ID_STUFF_GO 9002
#define ID_ABOUT 9003
#define IDC_STATIC -1
const char g_szClassName[] = "myWindowClass";


BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{ 
    
    switch(Message)
    {
    case WM_INITDIALOG:
      return TRUE;
    
    case WM_COMMAND:
    
      switch(LOWORD(wParam))
    
               {
    case IDOK:
               EndDialog(hwnd, IDOK);
               break;
    case IDCANCEL:
               EndDialog(hwnd, IDCANCEL);              
               break;
               }
               break;
    default:
             return FALSE;
             }
             return TRUE;
             }

// Step 4: the Window Procedure
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
        
    switch(msg)
    {
               case WM_CREATE:
        {
            HMENU hMenu, hSubMenu;

            hMenu = CreateMenu();

            hSubMenu = CreatePopupMenu();
            AppendMenu(hSubMenu, MF_STRING, ID_FILE_EXIT, "E&xit");
            AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "&File");

            hSubMenu = CreatePopupMenu();
            AppendMenu(hSubMenu, MF_STRING, ID_STUFF_GO, "&Go");
            AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "&Stuff");
            
            hSubMenu = CreatePopupMenu();
            AppendMenu(hSubMenu, MF_STRING, ID_ABOUT, "&ABOUT");
            AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "&HELP");

            SetMenu(hwnd, hMenu);

//THis code below was commented out due to no icon being used.
            /*hIcon = LoadImage(NULL, "menu_two.ico", IMAGE_ICON, 32, 32, LR_LOADFROMFILE);
            if(hIcon)
                SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
            else
                MessageBox(hwnd, "Could not load large icon!", "Error", MB_OK | MB_ICONERROR);

            hIconSm = LoadImage(NULL, "menu_two.ico", IMAGE_ICON, 16, 16, LR_LOADFROMFILE);
            if(hIconSm)
                SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
            else
                MessageBox(hwnd, "Could not load small icon!", "Error", MB_OK | MB_ICONERROR);
        */
        }
        
        break;
        
        
        case WM_COMMAND:
            
         switch(LOWORD(wParam))
    {
        case ID_ABOUT:
        {
            int ret = DialogBox(GetModuleHandle(NULL), 
                MAKEINTRESOURCE(ID_ABOUT), hwnd, AboutDlgProc);
            if(ret == IDOK)
            {
                MessageBox(hwnd, "Dialog exited with IDOK.", "Notice",
                    MB_OK | MB_ICONINFORMATION);
            }
            else if(ret == IDCANCEL)
            {
                MessageBox(hwnd, "Dialog exited with IDCANCEL.", "Notice",
                    MB_OK | MB_ICONINFORMATION);
            }
            else if(ret == -1)
            {
                MessageBox(hwnd, "Dialog failed!", "Error",
                    MB_OK | MB_ICONINFORMATION);
            }
            
        }
        break;

                     
            
                case ID_FILE_EXIT:
                     
                      PostQuitMessage(0);
                break;
                case ID_STUFF_GO:
                   system("explorer c:\\");

                break;
            }
        break;

        case WM_CLOSE:
            DestroyWindow(hwnd);
        break;
        case WM_DESTROY:
            PostQuitMessage(0);
        break;
        default:
            return DefWindowProc(hwnd, msg, wParam, lParam);
            
    }
    return 0;
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
{
    WNDCLASSEX wc;
    HWND hwnd;
    MSG Msg;

    //Step 1: Registering the Window Class
    wc.cbSize        = sizeof(WNDCLASSEX);
    wc.style         = 0;
    wc.lpfnWndProc   = WndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = hInstance;
    wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    wc.lpszMenuName  = NULL;
    wc.lpszClassName = g_szClassName;
    wc.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);

    if(!RegisterClassEx(&wc))
    {
        MessageBox(NULL, "Window Registration Failed!", "Error!",
            MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }

    // Step 2: Creating the Window
    hwnd = CreateWindowEx(
        WS_EX_CLIENTEDGE,
        g_szClassName,
        "OEBEL STUDIOS",
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT, CW_USEDEFAULT, 240, 120,
        NULL, NULL, hInstance, NULL);

    if(hwnd == NULL)
    {
        MessageBox(NULL, "Window Creation Failed!", "Error!",
            MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }   

    ShowWindow(hwnd, nCmdShow);
    UpdateWindow(hwnd);

    // Step 3: The Message Loop
    while(GetMessage(&Msg, NULL, 0, 0) > 0)
    {
        TranslateMessage(&Msg);
        DispatchMessage(&Msg);
    }
    return Msg.wParam;
}

// Here is my resource file containing the dialogs properties.

// ID_ABOUT dialog resource script for my program
// FileName: "diag1.rc"
ID_ABOUT DIALOG DISCARDABLE  0, 0, 239, 66
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "My About Box"
FONT 8, "MS Sans Serif"
BEGIN
    DEFPUSHBUTTON   "&OK",IDOK,174,18,50,14
    PUSHBUTTON      "&Cancel",IDCANCEL,174,35,50,14
    GROUPBOX        "About this program...",IDC_STATIC,7,7,225,52
    CTEXT           "An example program showing how to use Dialog Boxes\r\n\r\nby Cody",
                    IDC_STATIC,16,18,144,33
END

can't find the ID for the HELP button..where is it?..

case [B]ID_ABOUT[/B]:
        {
            int ret = DialogBox(GetModuleHandle(NULL), 
                MAKEINTRESOURCE([B]ID_ABOUT[/B]), hwnd, AboutDlgProc);

HINT : use a different command ID from the dialog ID..:)

can't find the ID for the HELP button..where is it?..

case [B]ID_ABOUT[/B]:
        {
            int ret = DialogBox(GetModuleHandle(NULL), 
                MAKEINTRESOURCE([B]ID_ABOUT[/B]), hwnd, AboutDlgProc);

HINT : use a different command ID from the dialog ID..:)

ABout your hint... IM just stumped... I double checked to ensure no syntax was missing etc. Instead of using case ID_ABOUT, I swapped it to case 9003: using the identifier number, but the same problem persist. I dont want to re-vamp the entire code or use the tutorials exact code because I wont learn why this is happening. So before I continue furtehr into the tutorial I said to myself I must first understand why this is happening. Even if the answer is given to me! It's bugging the heck out of me LOL.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.