유용한 정보

[C++]Popup Menu 만들기

DevReff 2024. 12. 26. 19:32
728x90
SMALL
반응형

HMENU menu;
POINT pt;
menu = CreatePopupMenu();
SetForegroundWindow( hDlg );
GetCursorPos( &pt );
int i = 19;

HBITMAP bm = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_TEST));
AppendMenu(menu, MF_BITMAP, i++, (LPCTSTR)bm);//LoadIcon(hInst, MAKEINTRESOURCE(IDI_TEST)));//_TEXT("meh meh") );
AppendMenu( menu, MF_BITMAP, i++, (LPCTSTR)bm);//_TEXT("testo") );
AppendMenu( menu, MF_BITMAP, i++, (LPCTSTR)bm);//_TEXT("foobar foobar") );
AppendMenu( menu, MF_BITMAP|MF_MENUBREAK, i++, (LPCTSTR)bm);//_TEXT("foobar foobar") );
AppendMenu( menu, MF_BITMAP, i++, (LPCTSTR)bm);//_TEXT("foobar foobar") );
AppendMenu( menu, MF_BITMAP, i++, (LPCTSTR)bm);//_TEXT("foobar foobar") );
TrackPopupMenuEx( menu, 0, pt.x, pt.y, hDlg, NULL );
DestroyMenu( menu );

 

출처: https://use1348.tistory.com/14 [유용한 정보:티스토리]