I'm trying to create a dynamic popup menu within my application, the generation code I use is something like that :
HMENU menu;
POINT pt;
menu = CreatePopupMenu();
SetForegroundWindow( receivingWindow );
GetCursorPos( &pt );
int i = 19;
AppendMenu( menu, MF_STRING, i++, _TEXT("meh meh") );
AppendMenu( menu, MF_STRING, i++, _TEXT("testo") );
AppendMenu( menu, MF_STRING, i++, _TEXT("foobar foobar") );
TrackPopupMenuEx( menu
, 0
, pt.x, pt.y
, receivingWindow
, NULL );
DestroyMenu( menu );
_TEXT
is used to ensure text is in Unicode and receivingWindow
is a Layered window created before and working well.
When calling TrackPopupMenuEx
the menu is displayed with the good size and at the good position, but absolutely no text appear in the popup menu. Did someone got an idea why, and how to fix this problem?
EDIT: more information regarding my environment :
- Windows 7 x64
- x86 build in Visual Studio 2008
EDIT2: I've tested the same on Windows XP x86, and it works like a charm, and after further test, the menu is well displayed in Windows 7 x64 with the classic look.