1. Je souhaite trouver une fenêtre et définir le focus, mais la fenêtre n'est pas active.Recherche d'une fenêtre et réglage de la mise au point
2.Si j'utilise HWND_TOP alors il ne rend pas la fenêtre active et si j'utilise HWND_TOPMOST alors il rend la fenêtre toujours au-dessus.
Quelqu'un peut-il m'aider?
HWND hwndAppDlg = ::FindWindowEx(hwndDesktop,NULL,lpszClass,lpszWindow);
if(hwndAppDlg && IsWindow(hwndAppDlg))
{
CRect rcAppDlg;
if(0 == ::GetWindowRect(hwndAppDlg,rcAppDlg))
{
OutputDebugString(L"\n GetWindowRect failed...");
return FALSE;
}
if(0 == ::SetWindowPos(hwndAppDlg,HWND_TOPMOST,rcAppDlg.left,rcAppDlg.top,rcAppDlg.Width(),rcAppDlg.Height(),SWP_SHOWWINDOW))
{
OutputDebugString(L"\n SetWindowPos failed...");
return FALSE;
}
if(0 == ::PostMessage(hwndAppDlg,WM_SETFOCUS,0,0))
{
OutputDebugString(L"\n WM_SETFOCUS failed");
return FALSE;
}
return TRUE;
}
il n'active même pas le dialogue. – Ashish