Heres my current code:

#include <windows.h>
#include "menu.h"
int win_w=640;
int win_h=480;
const char* win_cap="VMake";
 
 
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
static char gszClassName[]  = "db";
static HINSTANCE ghInstance = NULL;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
       WNDCLASSEX WndClass;
       HWND hwnd;
       MSG Msg;
       ghInstance = hInstance;
       WndClass.cbSize        = sizeof(WNDCLASSEX);
       WndClass.style         = NULL;
       WndClass.lpfnWndProc   = WndProc;
       WndClass.cbClsExtra    = 0;
       WndClass.cbWndExtra    = 0;
       WndClass.hInstance     = ghInstance;
       WndClass.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
       WndClass.hCursor       = LoadCursor(NULL, IDC_ARROW);
       WndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
       WndClass.lpszMenuName  = NULL;
       WndClass.lpszClassName = gszClassName;
       WndClass.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);
       if(!RegisterClassEx(&WndClass)) {
               MessageBox(0, "Window Registration Failed!", "Error!", MB_ICONSTOP | MB_OK);
               return 0;
       }
       hwnd = CreateWindowEx(
               WS_EX_STATICEDGE,
               gszClassName,
               win_cap,
               WS_OVERLAPPEDWINDOW,
               CW_USEDEFAULT, CW_USEDEFAULT,
               win_w, win_h,
               NULL, NULL,
               ghInstance,
               NULL);
       if(hwnd == NULL) {
               MessageBox(0, "Window Creation Failed!", "Error!", MB_ICONSTOP | MB_OK);
               return 0;
       }
       ShowWindow(hwnd, nCmdShow);
       UpdateWindow(hwnd);
       while(GetMessage(&Msg, NULL, 0, 0)) {
               TranslateMessage(&Msg);
               DispatchMessage(&Msg);
       }
       return Msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
       HMENU hMenu, hSubMenu;
       switch(Message) {
               case WM_CLOSE:
                       DestroyWindow(hwnd);
                       break;
               case WM_DESTROY:
                       PostQuitMessage(0);
                       break;
               case WM_CREATE:
                       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_FILE_WEB, "VMake Website");
                       AppendMenu(hSubMenu, MF_STRING, ID_HELP_ABOUT, "&About VMake");
                       AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "&Help");
                       SetMenu(hwnd, hMenu);
                       break;
               case WM_COMMAND:
                       switch(LOWORD(wParam)) {
                               case ID_FILE_EXIT:
                                       PostQuitMessage(0);
                               case ID_HELP_about:
                                       MessageBox(hwnd, "VMake Game Creation Software. \n Blokdudez and VMake hold no responsibility for\nany harmful and/or dangerous programs created with it \n All right reserved", "About", 0);
                               case ID_FILE_WEB:
                                    ShellExecute(hwnd, NULL, "[url]http://blokdudez.110mb.com/VMake.html[/url]", NULL, NULL, SW_SHOWNORMAL);
                                       break;
                       }
                       break;
               default:
                       return DefWindowProc(hwnd, Message, wParam, lParam);
       }
       return 0;
}

And in menu.h:

#define ID_FILE_EXIT          100
#define ID_HELP_ABOUT         101
#define ID_FILE_WEB           102

It works liike it suposed to and all but when you go and click on exit in the file menu it opens up the website and freezes

Any ideas?

Nvmd, I fgured it out.

I just replaced:

[LIST=1]
[*]    [B]case[/B] ID_FILE_EXIT:<LI class=li1>                                       PostQuitMessage[B]([/B]0[B])[/B];
<LI class=li2>                               [B]case[/B] ID_HELP_about:
<LI class=li1>                                       MessageBox[B]([/B]hwnd, "VMake Game Creation Software. [B]\n[/B] Blokdudez and VMake hold no responsibility for[B]\n[/B]any harmful and/or dangerous programs created with it [B]\n[/B] All right reserved", "About", 0[B])[/B];
<LI class=li1>                               [B]case[/B] ID_FILE_WEB:
<LI class=li1>                                    ShellExecute[B]([/B]hwnd, [B]NULL[/B], "[url]http://blokdudez.110mb.com/VMake.html[/url]", [B]NULL[/B], [B]NULL[/B], SW_SHOWNORMAL[B])[/B];
[*]                                       [B]break[/B];
[/LIST]

with:

case ID_FILE_EXIT:
                                       PostQuitMessage(0);
                                       break;
                               case ID_HELP_ABOUT:
                                       MessageBox(hwnd, "VMake Game Creation Software. \n Blokdudez and VMake hold no responsibility for\nany harmful and/or dangerous programs created with it \n All right reserved", "About", 0);
                                       break;
                               case ID_FILE_WEB:
                                    ShellExecute(hwnd, NULL, "[URL]http://blokdudez.110mb.com/VMake.html[/URL]", NULL, NULL, SW_SHOWNORMAL);
                                       break;

Thnx anyway.

you forgot the break statements after each case statement beginning on line 77. That's why the ID_FILE_EXIT menu falls through and executes each of the other case statements too.

[edit]I see you added those break statements :) [/edit]

This article has been dead for over six months. Start a new discussion instead.