I want to make something like on your internet browser. It will have a File then an exit at the bottom of the list. So I want to have it like that where it exits the program. (and like Dev C++ and any other program [I am not programming a web browser])
Ok here is my code please help:
#define ID_Exit 1
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_CREATE:{
HMENU hMenubar = CreateMenu();
HMENU hFile = CreateMenu();
AppendMenu(hMenubar, MF_POPUP, (UINT_PTR)hFile, "File");
AppendMenu(hFile, MF_STRING, ID_Exit, "Exit");
SetMenu(hwnd, hMenubar);
break;
}
case WM_COMMAND:{
if (LOWORD(wParam) == ID_Exit){
void exit ( int status );
}
break;
}
You should use the Windows function DestroyWindow to destroy the main window: