只知道窗口的句柄怎么判断它是激活状态?
成功马上结贴!~!

解决方案 »

  1.   

    你可以用::GetActiveWindow()先得到当前的active window,然后判断是不是和你的窗口HWND相等,如果相等就是激活的,否则不是激活的。
      

  2.   

    CWnd::Attach  
    BOOL Attach( HWND hWndNew );Return ValueNonzero if successful; otherwise 0.ParametershWndNewSpecifies a handle to a Windows window.ResAttaches a Windows window to a CWnd object.Example// Using Attach and Detach to map to the MDI client window
    class CMainFrame : public CMDIFrameWnd
    {
    ...
    public:
       CWnd  m_wndMDIClient;
    }CMainFrame::~CMainFrame()
    {
       // detach MDI client window
       m_wndMDIClient.Detach();
    }int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
       if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
          return -1;   // attach MDI client window
       if (m_wndMDIClient.Attach(m_hWndMDIClient) == 0)
       {
          TRACE0("Failed to attach MDIClient.\n");
          return -1;      // fail to create
       }
    }
      

  3.   

    lizhongbin(闪客) 的方法不错
      

  4.   


    用GetForegroundWindow 是以下,比较你的handle .