子窗口获得焦点的问题,搞不清楚了
CMyDialog senm = new CMyDialog;
senm-> Create(IDD_MSGSEND_DIALOG,GetDesktopWindow());
senm-> ShowWindow(SW_SHOW);
senm-> SetFocus();//为什么无效的??子窗口还是不显示出来
[解决办法]
BOOL MakeWindowGetFocus(HWND hDestWnd)
{
DWORDdwCurTId;
DWORDdwDestTId;
dwCurTId = ::GetCurrentThreadId();
dwDestTId = GetWindowThreadProcessId(hDestWnd, NULL);
::AttachThreadInput(dwCurTId, dwDestTId, TRUE);
::SetForegroundWindow(hDestWnd);
::SetFocus(hDestWnd);
::AttachThreadInput(dwCurTId, dwDestTId, FALSE);
return TRUE;
}
[解决办法]
CMyDialog senm = new CMyDialog;
-------
CMyDialog* senm = new CMyDialog;
senm-> SetFocus();//为什么无效的?
-------
没有必要
[解决办法]
如果是在::OnInitDialog()中的话,有下面一句,
return TRUE; // return TRUE unless you set the focus to a control
这里要改成 return FLASE;