Context Menu and displaying menu on screen
-
hey there fellow cpians.. Hope all is good. I wonder if anyone can help me with my right-click context menu problem. my problem is that when i display my menu it is displayed at the top-left of my application and no where near where the mouse icon is, when the right button was clicked! here is the code i am using in my function: OnContextMenu
CMenu menu; if (menu.LoadMenu(IDR_MENU1)) { ClientToScreen(&point); CMenu *pContextMenu = menu.GetSubMenu(0); pContextMenu->TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this); }
I think my issue has something to do with ClientToScreen or i need to call ScreenToClient maybe.. If i leave out the call to ClientToScreen then the menu is displayed at the top-left of the screen. thanks in advance. -
hey there fellow cpians.. Hope all is good. I wonder if anyone can help me with my right-click context menu problem. my problem is that when i display my menu it is displayed at the top-left of my application and no where near where the mouse icon is, when the right button was clicked! here is the code i am using in my function: OnContextMenu
CMenu menu; if (menu.LoadMenu(IDR_MENU1)) { ClientToScreen(&point); CMenu *pContextMenu = menu.GetSubMenu(0); pContextMenu->TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this); }
I think my issue has something to do with ClientToScreen or i need to call ScreenToClient maybe.. If i leave out the call to ClientToScreen then the menu is displayed at the top-left of the screen. thanks in advance.dont worry about this one guys.. i have replaced ClientToScreen with the function GetCursorPos and all is rosey!!