我想问下,如何做出一个判断是否该窗口为当前激活窗口?
如果是,则进行操作,如果不是,则无操作,是不是用GetActiveWindow啊?
如何用啊?

解决方案 »

  1.   

    HWND ahwnd = GetForegroundWindow(); 
    返回的就是当前处于激活状态的窗口句柄楼主可以通过判断句柄来判断是不是当前窗口
      

  2.   


    HWND hwnd = GetForegroundWindow(); 
    if(hwnd==this-> m_hWnd) //this-> m_hWnd (当前窗口句柄)
    {
    do something...
    }
      

  3.   


    出现了错误?
    error C2440: 'initializing' : cannot convert from 'class CWnd *' to 'struct HWND__ *'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
      

  4.   

    HWND hwnd = ::GetForegroundWindow(); 这样试试看