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

C / C++ / MFC

 
GeneralRe: STUPID PROBLEM Pin
Ted Ferenc12-Dec-02 9:36
Ted Ferenc12-Dec-02 9:36 
GeneralRe: STUPID PROBLEM Pin
Sunnygirl12-Dec-02 9:43
Sunnygirl12-Dec-02 9:43 
GeneralRe: STUPID PROBLEM Pin
Ted Ferenc12-Dec-02 10:24
Ted Ferenc12-Dec-02 10:24 
GeneralRe: STUPID PROBLEM Pin
Michael Dunn12-Dec-02 9:49
sitebuilderMichael Dunn12-Dec-02 9:49 
GeneralRe: STUPID PROBLEM Pin
Sunnygirl12-Dec-02 10:08
Sunnygirl12-Dec-02 10:08 
GeneralRe: STUPID PROBLEM Pin
Sunnygirl12-Dec-02 10:22
Sunnygirl12-Dec-02 10:22 
GeneralDynamic context menus.... Pin
RedZenBird12-Dec-02 9:04
RedZenBird12-Dec-02 9:04 
GeneralRe: Dynamic context menus.... Pin
RedZenBird12-Dec-02 13:19
RedZenBird12-Dec-02 13:19 
Just in case anyone is at all curious...here is the fix. The trouble seems to be that even though a popup menu is created, it must be stored in a containing menu object, and then refetched from that container.....very wierd.....

// first create the popup menu
//
CMenu oPopup;
VERIFY( oPopup.CreatePopupMenu() );

// now add all the commands to it from the command/prompt list
//
CONTEXT_COMMANDS_ITER oMenuCommandsIter;
for ( oMenuCommandsIter  = poCommands->begin();
      oMenuCommandsIter != poCommands->end();
      oMenuCommandsIter++ )
{
  oPopup.AppendMenu( MF_STRING, 
                     (*oMenuCommandsIter).first,
                     (*oMenuCommandsIter).second.c_str() );
}


// create the container menu and insert the popup into it
//
// see: MSDN: Q75254
// PRB: TrackPopupMenu() on LoadMenuIndirect() Menu Causes UAE
//
CMenu oMenu;
VERIFY( oMenu.CreateMenu() );
oMenu.InsertMenu( 0, MF_POPUP, (UINT)oPopup.m_hMenu, "Ignored" );

// now have to pull the popup menu back out of the containing menu
// I know its strange, but this is how it works......
//
CMenu* poPopup = oMenu.GetSubMenu( 0 );
ASSERT( poPopup != NULL );

ClientToScreen( &oPoint );

DWORD dwResult = poPopup->TrackPopupMenu( TPM_LEFTALIGN | TPM_RIGHTBUTTON |
                                          TPM_NONOTIFY | TPM_RETURNCMD, 
                                          oPoint.x, 
                                          oPoint.y,
                                          this );

ASSERT( oMenu.DestroyMenu() );
ASSERT( oPopup.DestroyMenu() );


Just trying to keep the forces of entropy at bay
GeneralRe: Dynamic context menus.... Pin
Member 9612-Dec-02 13:22
Member 9612-Dec-02 13:22 
GeneralRe: Dynamic context menus.... Pin
RedZenBird12-Dec-02 13:45
RedZenBird12-Dec-02 13:45 
GeneralCombo box cur sel index Pin
jimNLX12-Dec-02 8:13
jimNLX12-Dec-02 8:13 
GeneralRe: Combo box cur sel index Pin
valikac12-Dec-02 13:04
valikac12-Dec-02 13:04 
GeneralRe: Combo box cur sel index Pin
Anonymous13-Dec-02 3:47
Anonymous13-Dec-02 3:47 
GeneralRe: Combo box cur sel index Pin
Anonymous13-Dec-02 13:49
Anonymous13-Dec-02 13:49 
QuestionAnti-Virus Style File/Folder Selection Control? Pin
James Wood12-Dec-02 7:39
James Wood12-Dec-02 7:39 
Questionworking with .csv files? Pin
trustno112-Dec-02 6:40
trustno112-Dec-02 6:40 
AnswerRe: working with .csv files? Pin
Nitron12-Dec-02 7:14
Nitron12-Dec-02 7:14 
QuestionNow I know how to send HTML (of any size) directly to the HTMLView, but the first time it don't work properly, could you take a look at it? Pin
Joan M12-Dec-02 5:57
professionalJoan M12-Dec-02 5:57 
AnswerRe: Now I know how to send HTML (of any size) directly to the HTMLView, but the first time it don't work properly, could you take a look at it? Pin
Ravi Bhavnani12-Dec-02 6:50
professionalRavi Bhavnani12-Dec-02 6:50 
GeneralRe: Now I know how to send HTML (of any size) directly to the HTMLView, but the first time it don't work properly, could you take a look at it? Pin
Joan M12-Dec-02 7:03
professionalJoan M12-Dec-02 7:03 
GeneralRe: Now I know how to send HTML (of any size) directly to the HTMLView, but the first time it don't work properly, could you take a look at it? Pin
Ravi Bhavnani12-Dec-02 7:11
professionalRavi Bhavnani12-Dec-02 7:11 
GeneralRe: Now I know how to send HTML (of any size) directly to the HTMLView, but the first time it don't work properly, could you take a look at it? Pin
Joan M12-Dec-02 7:22
professionalJoan M12-Dec-02 7:22 
GeneralRe: Now I know how to send HTML (of any size) directly to the HTMLView, but the first time it don't work properly, could you take a look at it? Pin
Joan M12-Dec-02 7:31
professionalJoan M12-Dec-02 7:31 
GeneralGetting Assert error with CFileDialog::DoModal Pin
Luis E. Cuadrado12-Dec-02 5:23
Luis E. Cuadrado12-Dec-02 5:23 
GeneralRe: Getting Assert error with CFileDialog::DoModal Pin
retZ12-Dec-02 5:43
retZ12-Dec-02 5:43 

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.