#include <windows.h>
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow)
{
WNDCLASS myWindow;
myWindow.cbClsExtra = 0;
myWindow.cbWndExtra = 0;
myWindow.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
myWindow.hCursor = LoadCursor(NULL, IDC_ARROW);
myWindow.hIcon = NULL;
myWindow.hInstance = hInstance;
myWindow.lpfnWndProc = WndProc;
myWindow.lpszClassName = TEXT("Levi");
myWindow.lpszMenuName = 0;
myWindow.style = CS_VREDRAW | CS_HREDRAW;
RegisterClass(&myWindow);
HWND myHandle = CreateWindowEx(NULL, TEXT("Levi"), TEXT("My Window"), WS_OVERLAPPEDWINDOW, 10, 10, 200, 200, NULL, NULL, hInstance, NULL);
ShowWindow(myHandle, iCmdShow);
UpdateWindow(myHandle);
//////////////////////////////////////////////////
MSG message;
while(GetMessage(&message, NULL, 0, 0))
{
TranslateMessage(&message);
DispatchMessage(&message);
}
return message.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_CREATE:
Beep(50, 10);
return 0;
break;
case WM_PAINT:
HDC hdc;
PAINTSTRUCT ps;
hdc = BeginPaint(hwnd, &ps);
Ellipse(hdc, 20, 20, 160, 160);
Rectangle(hdc, 50, 50, 90, 90);
Rectangle(hdc, 100, 50, 140, 90);
EndPaint(hwnd, &ps);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
break;
}
return DefWindowProc( hwnd, message, wParam, lParam );
}
I cant find any straight forward tutorials or reference to add a menu to a window created using Win API. Any one point me in the right direction or give me some advice? Thanks