更改新闻标签上的焦点 [英] Changing Focus on Press Tab

查看:68
本文介绍了更改新闻标签上的焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Plain Win32中,我已经解决了这个问题.其实很简单.我写了如下的消息循环:

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);
        }
    }



IsDialogMessage中的HWND都不是对话框.

反正.在mfc中可以做什么?

我认为,我可以使用



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

函数,并执行与上述相同的操作...

但我不喜欢它作为解决方案.如果我需要超过1000个处理程序(只会说),将会发生什么情况.

在这种情况下,这可能是一个解决方案

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;
}



但是在mfc(我不擅长C ++)的情况下,所有子窗口都是从各种Class派生的.是否可以为各种班级做以上类似的事情.

这是我在想的一个例子.




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; //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.

推荐答案

仅检查所需的消息,并考虑可以同时激活哪些窗口时间.

一般来说,您应该处理真正涉及的消息和窗口.而且并非所有传入.那就是"lam";-)
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" ;-)


这篇关于更改新闻标签上的焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆