In Plain Win32 I have worked with this issue. in fact its very simple. I wrote the message loop like below:
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
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..
ArrayOfRunningHwnd.Number[0]=m_pclassC;
ArrayOfRunningHwnd.Number[1]=m_pclassA;
ArrayOfRunningHwnd.Number[2]=m_pclassB;
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.