Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In Plain Win32 I have worked with this issue. in fact its very simple. I wrote the message loop like below:
C#
while(GetMessage(&msg,0,0,0))
    {
        if (!IsDialogMessage(ghwnd, &msg) && !IsDialogMessage(hViewWindow, &msg) && !TranslateAccelerator( msg.hwnd,haccel ,&msg))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }


none of the HWND in IsDialogMessage is dialog box.

Anyway. What can be done in mfc?

I think, I can over ride the
C#
CWinApp::Run
Function and do the same thing like above...

But I dont like it as a solution. What would happen if I need more than 1000 handler(just saying).

in that case it can be a solution
ArrayOfRunningHwnd.Number[0]=Hwnd1;
ArrayOfRunningHwnd.Number[1]=Hwnd2;
ArrayOfRunningHwnd.Number[2]=Hwnd2;
ArrayOfRunningHwndcount=2;
bool processAllWindowForTab(ArrayOfRunningHwnd)
{
 for(int i=0;i<arrayofrunninghwndcount;i++)>
 {
  if(IsDialogMessage(ghwnd, &msg)==true)
   return true;
 }
 return false;
}


But In case of mfc(I am not good at C++) all sub window is derived from various Class. Is it possible to do something like above for those various class.

Here is an example what I am thinking..


C#
ArrayOfRunningHwnd.Number[0]=m_pclassC; //class C:public CWnd;
 ArrayOfRunningHwnd.Number[1]=m_pclassA; //class A:public CWnd;
 ArrayOfRunningHwnd.Number[2]=m_pclassB;//class B:public CWnd;
 ArrayOfRunningHwndcount=2;
 bool processAllWindowForTab(ArrayOfRunningHwnd)
 {
  for(int i=0;i<ArrayOfRunningHwndcount;i++)
  {
   if(IsDialogMessage(ghwnd, &msg)==true)
    return true;
  }
  return false;
 }


Will it work(You might think why i am asking. I can do and test it it does).

The reason I am asking is to know whether there is a better solution for this.
Posted

1 solution

Only check for the needed messages and also think what windows can be active at one time.

More generally spoken you should work on the really involved messages and windows. And NOT ALL incoming. Thats "lame" ;-)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900