Home > Back-end >  How custom window display window menu system?
How custom window display window menu system?

Time:09-21

When using custom style such as window title, how the popup menu system?
Don't custom menu system from scratch, just show the original system menu can

CodePudding user response:

//here is not to use any skills, brute force solution

Int x=Left + 5;//the position of the pop-up menu system x coordinates (relative to the left upper corner of the screen)
Int y=Top + 20;//the position of the pop-up menu system y coordinates (relative to the left upper corner of the screen)
HMENU hSysMenu=GetSystemMenu (Handle, FALSE);//get a handle to the system menu
Int iCmd=TrackPopupMenu (hSysMenu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD, x, y, 0, the Handle, NULL);//the pop-up menu system
If (iCmd)//if the user selects one of the menu item
{
PostMessage (Handle, WM_SYSCOMMAND, iCmd, 0);
//perform this menu item}
  • Related