-------------------------------------------------------------------------------- Previous code implements simple window without menu. The drawback of the code is that it does not process WM_DESTROY message to unload window from memory after running it (as result the program can not be rebuilt because it is still in memory even though Close Button on System Menu was pressed and one need to kill process manually - with Windows Task Manager as an option). In this demo WM_DESTROY message is handled in switch case structure windows callback function: switch( iMsg ) { case WM_DESTROY: { PostQuitMessage(0); break; } } Also simple menu structure with popup menus is added. Menu is created in case block of callback function in responce on WM_CREATE message: switch( iMsg ) { case WM_CREATE: { HMENU hMenuMain; HMENU hMenuPopup1,hMenuPopup2; hMenuMain = CreateMenu(); hMenuPopup1 = CreatePopupMenu(); AppendMenu(hMenuMain, MF_STRING|MF_POPUP,(UINT)hMenuPopup1,"Commands"); AppendMenu(hMenuPopup1,MF_STRING, IDM_COMMANDS, "Press Me ..."); hMenuPopup2 = CreatePopupMenu(); AppendMenu(hMenuMain, MF_STRING|MF_POPUP, (UINT)hMenuPopup2, "Help" ); AppendMenu(hMenuPopup2, MF_STRING, IDM_ABOUT, "About"); SetMenu ( hwnd, hMenuMain ); break; } } Constants IDM_COMMANDS and IDM_ABOUT are defined just above APIENTRY WinMain function: #define IDM_COMMANDS 101 //menu item ID is arbitrarily, but unique #define IDM_ABOUT 105 When a user clicks a menu item WM_COMMAND message is sent. This message contains information what specific menu item was pressed in LOWORD of wParam. Message is processed in another case block of windows callback function: case WM_COMMAND: { HMENU hMenu = GetMenu(hwnd); switch (LOWORD(wParam)) { case IDM_COMMANDS: { DWORD dMenuState = GetMenuState(hMenu, IDM_COMMANDS, MF_BYCOMMAND); if(dMenuState == MF_CHECKED) { CheckMenuItem(hMenu, IDM_COMMANDS, MF_BYCOMMAND | MF_CHECKED); } else { CheckMenuItem(hMenu, IDM_COMMANDS, MF_BYCOMMAND | MF_UNCHECKED); } break; } case IDM_ABOUT: { MessageBox(NULL, "You've just clicked About menu item", "Message", MB_OK); break; } } break; } --