myedit1.SetFocus(); //设置焦点 //myedit1是控件变量名 CWnd* pWnd = GetDlgItem(IDC_EDIT1);//设置焦点 pWnd->SetFocus(); CWnd* pWnd2 = GetDlgItem(IDC_EDIT2); HWND hWnd = pWnd2->GetSafeHwnd(); ::SetFocus(hWnd); //设置焦点 //全局函数 //返回值:若函数调用成功,则返回原先拥有键盘焦点的窗口句柄。若hWnd参数无效或窗口未与调用线程的消息队列相关,则返回值为NULL
标签:SetFocus,MFC,焦点,pWnd,设置,hWnd,IDC From: https://www.cnblogs.com/liming19680104/p/16931937.html