Click here to Skip to main content
16,006,006 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralIncluding files as a resource Pin
User 665810-Aug-02 8:37
User 665810-Aug-02 8:37 
GeneralRe: Including files as a resource Pin
Chris Losinger10-Aug-02 10:34
professionalChris Losinger10-Aug-02 10:34 
GeneralRe: Including files as a resource Pin
User 665810-Aug-02 11:01
User 665810-Aug-02 11:01 
GeneralRe: Including files as a resource Pin
User 665810-Aug-02 11:54
User 665810-Aug-02 11:54 
GeneralGDI Resource allocation Pin
Stew10-Aug-02 8:36
Stew10-Aug-02 8:36 
GeneralRe: GDI Resource allocation Pin
NormDroid10-Aug-02 9:39
professionalNormDroid10-Aug-02 9:39 
GeneralRe: GDI Resource allocation Pin
Stew10-Aug-02 11:12
Stew10-Aug-02 11:12 
GeneralContext Menu & Dialog Box :: MFC Pin
valikac10-Aug-02 7:42
valikac10-Aug-02 7:42 
Hi.

I would like to implement a context menu inside a dialog box. I created a "clear" menu (no caption) using Resource Editor. Note that I create an entirely new menu item like IDR_MAINFRAME (mine is IRD_CONTEXTMENU1. Inside the dialog box, I added a message for right-click. Here is what the code looks like.

-----
CPoint mPointCurrent;
::GetCursorPos(&mPointCurrent);
CMenu mPopupMenu;
mPopupMenu.LoadMenu(IRD_CONTEXTMENU1);

// Program crashes at this point.

CMenu *pContextMenu = mPopupMenu.GetSubMenu(0);
pContextMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_NONOTIFY,
mPointCurrent.x, mPointCurrent.y, GetActiveWindow(), NULL);
-----

The code above does not work. The program crashes when I right-click inside the dialog box. Is the code above for a view class only? Is there a different and corrent way to implement a context menu inside a dialog box?

Thanks,
Kuphryn
GeneralRe: Context Menu & Dialog Box :: MFC Pin
Jan Hirak10-Aug-02 7:54
Jan Hirak10-Aug-02 7:54 
GeneralRe: Context Menu & Dialog Box :: MFC Pin
Shog910-Aug-02 8:06
sitebuilderShog910-Aug-02 8:06 
GeneralRe: Context Menu & Dialog Box :: MFC Pin
Shog910-Aug-02 8:00
sitebuilderShog910-Aug-02 8:00 
GeneralRe: Context Menu & Dialog Box :: MFC Pin
valikac10-Aug-02 8:32
valikac10-Aug-02 8:32 
GeneralSet right alignment fo tab stops Pin
Jan Hirak10-Aug-02 7:33
Jan Hirak10-Aug-02 7:33 
GeneralRe: Set right alignment fo tab stops Pin
Shog910-Aug-02 8:09
sitebuilderShog910-Aug-02 8:09 
QuestionIs there a way to print into ms word or wordperfect? DDE? Pin
DanYELL10-Aug-02 6:34
DanYELL10-Aug-02 6:34 
QuestionHow to handle drag-n-drop zipped content? Pin
Hiusing10-Aug-02 6:24
Hiusing10-Aug-02 6:24 
GeneralMemory Management Pin
Stew10-Aug-02 6:21
Stew10-Aug-02 6:21 
GeneralRe: Memory Management Pin
Maximilien10-Aug-02 6:30
Maximilien10-Aug-02 6:30 
GeneralRe: Memory Management Pin
Todd Smith11-Aug-02 8:15
Todd Smith11-Aug-02 8:15 
GeneralThreads Pin
AJ12310-Aug-02 6:00
AJ12310-Aug-02 6:00 
GeneralRe: Threads Pin
Paul M Watt10-Aug-02 6:19
mentorPaul M Watt10-Aug-02 6:19 
GeneralRe: Threads Pin
AJ12310-Aug-02 6:29
AJ12310-Aug-02 6:29 
GeneralRe: Threads Pin
Daniel Lohmann11-Aug-02 6:52
Daniel Lohmann11-Aug-02 6:52 
GeneralRe: Threads Pin
Wes Jones12-Aug-02 14:34
Wes Jones12-Aug-02 14:34 
QuestionWhere do I get started? Pin
Sherry10-Aug-02 5:58
Sherry10-Aug-02 5:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.