title: How handle external application window? MFC
body: <p>I need handle another running application by name, id, or process handle. I get the ID and Process handles but I don't know how get handle of window to change external program title.</p>
  
  <p>There is my code:</p>
  
  <pre><code>BOOL CFindProcess::OnInitDialog()
  {
      CDialogEx::OnInitDialog();
      CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_PROCESS);
      HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
      PROCESSENTRY32 proc;
      proc.dwSize = sizeof(PROCESSENTRY32);
      if (Process32First(hSnap, &amp;proc)){
          pComboBox-&gt;AddString(proc.szExeFile);
          while (Process32Next(hSnap, &amp;proc)){
              if (0!=wcscmp(proc.szExeFile, L"svchost.exe"))
                  pComboBox-&gt;AddString(proc.szExeFile);
              if (wcscmp(proc.szExeFile, L"notepad.exe") == 0){
                  HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proc.th32ProcessID);
                  GetProcessId(hProcess);
                  AfxMessageBox(L"Handeled");
                  //SetWindowText(hProcess, L"Weather");
                  CloseHandle(hProcess);
              }
          }
      }
      CloseHandle(hSnap);
      return TRUE;
  }
  </code></pre>
  
  <p>my question is how get window handle of notepad.exe by name or ID, Process handles with MFC?</p>