LRESULT DoCreateMain(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
{
HWND hwndCB;
hwndCB = CommandBar_Create(g_hInst, hWnd, IDC_CMDBAR);
CommandBar_AddAdornments(hwndCB, 0, 0);
HMENU hMainMenu, hMenu;
hMainMenu = CreateMenu();
hMenu = CreateMenu();
AppendMenu(hMenu, MF_STRING|MF_ENABLED, 100, TEXT("&New"));
AppendMenu(hMenu, MF_STRING|MF_ENABLED, 101, TEXT("&Open"));
AppendMenu(hMenu, MF_STRING|MF_ENABLED, 102, TEXT("&Save"));
AppendMenu(hMenu, MF_STRING|MF_ENABLED, 103, TEXT("E&xit"));
AppendMenu(hMainMenu, MF_STRING|MF_ENABLED|MF_POPUP, (UINT)hMenu, TEXT("&File"));
CommandBar_InsertMenubarEx(hwndCB, NULL, hMainMenu, 0);
//error C2664: 'CommandBar_InsertMenubarEx' : cannot convert parameter 3 from 'HMENU' to 'LPTSTR',不能是菜单句柄吗?
return 0;
}
CommandBar_InsertMenubarEx(hwndCB, NULL, (LPTSTR)hMainMenu, 0);
改成这也没有效果。看不到菜单
学习一下
LRESULT DoCreateMain(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
{
HWND hwndCB;
hwndCB = CommandBar_Create(g_hInst, hWnd, IDC_CMDBAR);
HMENU hMainMenu, hMenu;
hMainMenu = CreateMenu();
hMenu = CreateMenu();
AppendMenu(hMenu, MF_STRING ?MF_ENABLED, 100, TEXT("&New"));
AppendMenu(hMenu, MF_STRING ?MF_ENABLED, 101, TEXT("&Open"));
AppendMenu(hMenu, MF_STRING ?MF_ENABLED, 102, TEXT("&Save"));
AppendMenu(hMenu, MF_STRING ?MF_ENABLED, 103, TEXT("E&xit"));
AppendMenu(hMainMenu, MF_STRING ?MF_ENABLED ?MF_POPUP, (UINT)hMenu, TEXT("&File"));
CommandBar_InsertMenubarEx(hwndCB, NULL, hMainMenu, 0);
CommandBar_AddAdornments(hwndCB, 0, 0);
return 0;
}