![]() |
| | #1 |
| Registered User Join Date: Sep 2006
Posts: 11
| How to use CreateMenu and AppendMenu Code: #include <windows.h>
#include <stdio.h>
int main(){
HWND hwnd;
HMENU menu;
HMENU subMenu;
hwnd = FindWindow("Notepad","Untitled - Notepad");
if (!hwnd) {
printf("Notepad is not running yet!!\n");
exit(0);
}
else {
ShowWindow(hwnd,SW_SHOWNORMAL);
SetForegroundWindow(hwnd);
menu = GetMenu(hwnd);
subMenu = CreateMenu();
AppendMenu(subMenu, MF_STRING | MF_POPUP, 100, "Bar");
AppendMenu(menu, MF_STRING, (UINT)subMenu, "Foo");
}
return 0;
}
Unfortunately, the "Bar" submenu (under "Foo") is not shown. What's wrong here? |
| TmX is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|