Code:
#include <windows.h>
#include <commctrl.h>
#include "resource.h"
LRESULT CALLBACK WndProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam);
static char gszClassName[] = "test";
static HINSTANCE ghInstance = NULL;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX WndClass;
HWND hwnd;
MSG Msg;
HACCEL hFkeys;
ghInstance = hInstance;
WndClass.cbSize = sizeof(WNDCLASSEX);
WndClass.style = NULL;
WndClass.lpfnWndProc = (WNDPROC)WndProc;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hInstance = ghInstance;
WndClass.hIcon = NULL;
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
WndClass.lpszMenuName = NULL;
WndClass.lpszClassName = gszClassName;
WndClass.hIconSm = NULL;
if (!RegisterClassEx(&WndClass)) {
MessageBox(0, "Window Registration Failed!", "Error!", MB_ICONSTOP | MB_OK);
return(0);
}
hwnd = CreateWindowEx(WS_EX_STATICEDGE, gszClassName, "test",
WS_SYSMENU | WS_MINIMIZEBOX, 150, 50, 500, 479, NULL,
NULL, ghInstance, NULL);
if (hwnd==NULL) {
MessageBox(0, "Window Creation Failed!", "Error!", MB_ICONSTOP | MB_OK);
return(0);
}
SetMenu(hwnd, LoadMenu(ghInstance, MAKEINTRESOURCE(ID_MENU)));
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
InitCommonControls();
while (GetMessage(&Msg, NULL, 0, 0))
if (!TranslateAccelerator(hwnd, hFkeys, &Msg)) {
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return(Msg.wParam);
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch (Msg)
{
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_CREATE:
break;
case WM_COMMAND:
{
switch(LOWORD(wParam))
{
/* check menu */
case IDM_SETTINGS_GROUP:
if (CheckMenuItem(GetSubMenu(GetMenu(hwnd), 3), IDM_SETTINGS_GROUP, MF_BYCOMMAND | MF_CHECKED)==-1)
MessageBox(NULL, "error!!!!", "", 0);
break;
}
}
break;
default: return(DefWindowProc(hwnd, Msg, wParam, lParam));
}
return(0);
}
here's the zip, i compiled it with borland 5.5: