c++ SetForegroundWindow

来源:百度知道 编辑:UC知道 时间:2024/06/23 04:44:58
SetForegroundWindow(CWnd::FindWindow(NULL , "a.txt - 记事本"));
怎么改啊。
cannot convert parameter 1 from 'class CWnd *' to 'struct HWND__ *'
对c++的类型不了解。
left of '->GetSafeHwnd' must point to class/struct/union

CWnd* pWnd=CWnd::FindWindow(NULL , "a.txt - 记事本");
HWND hWnd=NULL==pWnd?NULL:pWnd->GetSafeHwnd();
SetForegroundWindow(hWnd);

::SetForegroundWindow(::FindWindow(NULL , "a.txt - 记事本"));

直接调用API就可以了
加全局作用符吧...