Anonymous
So erstellen Sie mit der Win32 -API Text auf links und rechts im Menüelement Text?
Post
by Anonymous » 12 Apr 2025, 23:55
I want to make keyboard shortcuts visible on the right side of menu item, while its function on the left side like this:
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;
}
1744494944
Anonymous
I want to make keyboard shortcuts visible on the right side of menu item, while its function on the left side like this: [img]https://i.sstatic.net/BOiy8Iaz.png[/img] This is the code of WM_CREATE case in WndProc Funktion: < /p> [code]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; } [/code]