So erstellen Sie mit der Win32 -API Text auf links und rechts im Menüelement Text?C++

Programme in C++. Entwicklerforum
Anonymous
 So erstellen Sie mit der Win32 -API Text auf links und rechts im Menüelement Text?

Post by Anonymous »

I want to make keyboard shortcuts visible on the right side of menu item, while its function on the left side like this:

Image

This is the code of WM_CREATE case in WndProc Funktion: < /p>

Code: Select all

case WM_CREATE: {
HMENU hMenu = CreateMenu();

HMENU hMenuFile = CreateMenu();
HMENU hMenuEdit = CreateMenu();
HMENU hMenuFormat = CreateMenu();
HMENU hMenuHelp = CreateMenu();

AppendMenu(hMenu, MF_POPUP, (UINT_PTR)hMenuFile, _T("File"));
AppendMenu(hMenu, MF_POPUP, (UINT_PTR)hMenuEdit, _T("Edit"));
AppendMenu(hMenu, MF_POPUP, (UINT_PTR)hMenuFormat, _T("Format"));
AppendMenu(hMenu, MF_POPUP, (UINT_PTR)hMenuHelp, _T("Help"));

AppendMenu(hMenuFile, MF_STRING, 1, _T("New... (Ctrl+N)"));
AppendMenu(hMenuFile, MF_SEPARATOR, NULL, NULL);
AppendMenu(hMenuFile, MF_STRING, 1, _T("Open... (Ctrl+O)"));
AppendMenu(hMenuFile, MF_STRING, 1, _T("Save (Ctrl+S"));
AppendMenu(hMenuFile, MF_STRING, 1, _T("Save as... (Ctrl+Shift+S)"));
AppendMenu(hMenuFile, MF_SEPARATOR, NULL, NULL);
AppendMenu(hMenuFile, MF_STRING, 1, _T("Close... (Alt+F4)"));

AppendMenu(hMenuEdit, MF_STRING, 1, _T("Cut (Ctrl+X)"));
AppendMenu(hMenuEdit, MF_STRING, 1, _T("Copy (Ctrl+C)"));
AppendMenu(hMenuEdit, MF_STRING, 1, _T("Paste (Ctrl+V)"));

AppendMenu(hMenuFormat, MF_UNCHECKED, 1, _T("Word wrap"));
AppendMenu(hMenuFormat, MF_STRING, 1, _T("Font..."));

AppendMenu(hMenuHelp, MF_STRING, 1, _T("About..."));

SetMenu(hWnd, hMenu);
break;
}

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post