Originally Posted by
Joelito
Can we see how did you create the menu bar?
Sure. This code was generated by the MSVC.NET wizard:
Code:
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
MSG msg;
HACCEL hAccelTable;
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_SWITCHCONF, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
InitCommonControls();
...
Code:
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = (HICON)LoadImage(GetModuleHandle(NULL),
MAKEINTRESOURCE(IDI_SWITCHCONF32),
IMAGE_ICON, 32, 32, 0);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = (LPCTSTR)IDC_SWITCHCONF;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL),
MAKEINTRESOURCE(IDI_SWITCHCONF16),
IMAGE_ICON, 16, 16, 0);
return RegisterClassEx(&wcex);
}
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hInst = hInstance;
hWnd = CreateWindow(szWindowClass, szTitle,
WS_MINIMIZEBOX
|WS_MAXIMIZEBOX|WS_MAXIMIZE
|WS_SYSMENU|WS_BORDER,
0, 0, 1282, 51, NULL, NULL,
hInstance, NULL);
if (!hWnd)
{
return FALSE;
}
hMainWindow=hWnd;
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
The name of the accelerator table is IDC_SWITCHCONF; the menu has the same name.