Click here to Skip to main content
15,887,485 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Get an exception while opening a file Pin
Michael Schubert25-Nov-09 1:59
Michael Schubert25-Nov-09 1:59 
QuestionI have hooked the WSARecv function and get the packet . But how can i resend it to the program? Pin
reichtiger24-Nov-09 17:24
reichtiger24-Nov-09 17:24 
AnswerRe: I have hooked the WSARecv function and get the packet . But how can i resend it to the program? Pin
Adam Roderick J24-Nov-09 22:07
Adam Roderick J24-Nov-09 22:07 
QuestionPopmenu in View class Pin
Anu_Bala24-Nov-09 17:09
Anu_Bala24-Nov-09 17:09 
AnswerRe: Popmenu in View class Pin
JohnCz7-Dec-09 19:26
JohnCz7-Dec-09 19:26 
AnswerRe: Popmenu in View class Pin
JohnCz7-Dec-09 19:52
JohnCz7-Dec-09 19:52 
GeneralRe: Popmenu in View class Pin
shanmugarajaa9-Dec-09 15:56
shanmugarajaa9-Dec-09 15:56 
AnswerRe: Popmenu in View class Pin
JohnCz9-Dec-09 19:08
JohnCz9-Dec-09 19:08 
I will be straightforward and do not get upset.
Many posts start the same way yours did. You describe things assuming that I post responder knows every detail of your project. Unfortunately, nobody has a crystal ball, therefore reading intensions is not possible.
Second thing: I have asked some questions and most likely by answering them you would clarify your problem more. You have chosen to ignore all of my question and yet you expect me to answer yours.
Please help me to help you.
What I know is you are using what you describe as a dialog. From your description, it maybe is a CFormView.
Based only on assumption (modeless dialog) and unknown type of the application, not knowing how you invoke views (switching, creating new) , and assuming that you are using default MFC command message routing, I will be able only to point your mistakes that are obvious.

First, get rid of line sending command message from CMainFrame::OnUpdateFpgroup. I presume this is an update command UI handler. It is used to enable/disable or set/clear check or radio mark for a specific menu.
You are getting it after menu invoked by TrackPopupMenu is dismissed, only because you bypass or violate MFC routing mechanism.
You should use command message handler not update UI handler. Choose COMMAND not UPDATE_COMMAD_UI when you insert handler.

When you call TrackPopupMenu, you pass CWnd pointer received by the handler. Again frame window receives this message only because command routing is confused.

Most likely you do the same in a view, and that is causing undesirable behavior. Last parameter of the TrackPopupMenu call tell what window is supposed to handle this message. To properly route command you should pass a pointer to a first window that has a chance to handle it. If it does not, routing will continue. From top command i.e. Main frame down to first active child (frame or view) document, doc template (OLE stuff if registered) application).
Hence, in both cases, your call to TrackPopupMenu should be written like this:
CMenu mnuPopup;
mnuPopup.LoadMenu(IDR_POPUP_EDIT);

CMenu *mnuPopupMenu = mnuPopup.GetSubMenu(0);
ASSERT(mnuPopupMenu);

mnuPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, AfxGetMainWnd());


Get rid of checking if point is in the rectangle.

JohnCz
MS C++ MVP

QuestionProblem with mousewheel Pin
Rozis24-Nov-09 13:02
Rozis24-Nov-09 13:02 
AnswerRe: Problem with mousewheel Pin
«_Superman_»24-Nov-09 13:22
professional«_Superman_»24-Nov-09 13:22 
GeneralRe: Problem with mousewheel [modified] Pin
Rozis25-Nov-09 14:21
Rozis25-Nov-09 14:21 
QuestionHow to ask the user to choose a directory/folder? Pin
Anthony Appleyard24-Nov-09 11:06
Anthony Appleyard24-Nov-09 11:06 
AnswerRe: How to ask the user to choose a directory/folder? Pin
Maximilien24-Nov-09 12:08
Maximilien24-Nov-09 12:08 
QuestionMFC child modal CDialog appears in the task bar. ? Pin
Maximilien24-Nov-09 11:02
Maximilien24-Nov-09 11:02 
AnswerRe: MFC child modal CDialog appears in the task bar. ? Pin
«_Superman_»24-Nov-09 12:49
professional«_Superman_»24-Nov-09 12:49 
GeneralRe: MFC child modal CDialog appears in the task bar. ? Pin
Maximilien26-Nov-09 3:34
Maximilien26-Nov-09 3:34 
Questionwher should be a modeless dialog box be created Pin
Sujay chakraborty24-Nov-09 8:04
Sujay chakraborty24-Nov-09 8:04 
AnswerRe: wher should be a modeless dialog box be created Pin
«_Superman_»24-Nov-09 8:10
professional«_Superman_»24-Nov-09 8:10 
GeneralRe: wher should be a modeless dialog box be created Pin
Sujay chakraborty25-Nov-09 7:11
Sujay chakraborty25-Nov-09 7:11 
GeneralRe: wher should be a modeless dialog box be created Pin
Tim Craig25-Nov-09 9:29
Tim Craig25-Nov-09 9:29 
QuestionRe: wher should be a modeless dialog box be created Pin
Sujay chakraborty30-Nov-09 20:04
Sujay chakraborty30-Nov-09 20:04 
AnswerRe: wher should be a modeless dialog box be created Pin
Tim Craig30-Nov-09 20:58
Tim Craig30-Nov-09 20:58 
QuestionDefault data in data tab of combo box not working Pin
Sujay chakraborty24-Nov-09 8:00
Sujay chakraborty24-Nov-09 8:00 
AnswerRe: Default data in data tab of combo box not working Pin
«_Superman_»24-Nov-09 8:16
professional«_Superman_»24-Nov-09 8:16 
QuestionRe: Default data in data tab of combo box not working Pin
David Crow24-Nov-09 16:56
David Crow24-Nov-09 16:56 

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.