title: Cannot find window using FindWindow
body: <p>I've been trying to capture and copy to clipboard a window using C++. I've managed to make the code work for Notepad, but weirdly enough it won't find other windows that I tried : "Calculator" , "Wordpad", etc.</p>
  
  <p>This is the code:</p>
  
  <pre><code>    RECT rc;
  HWND hwnd = ::FindWindow(TEXT("Notepad"), NULL);    //the window can't be min
  if (hwnd == NULL)
  {
      cout &lt;&lt; "it can't find any 'note' window" &lt;&lt; endl;
      getchar();
      return 0;
  }
  GetClientRect(hwnd, &amp;rc);
  
  //create
  HDC hdcScreen = GetDC(NULL);
  HDC hdc = CreateCompatibleDC(hdcScreen);
  HBITMAP hbmp = CreateCompatibleBitmap(hdcScreen, rc.right - rc.left, rc.bottom - rc.top);
  SelectObject(hdc, hbmp);
  
  //Print to memory hdc
  PrintWindow(hwnd, hdc, PW_CLIENTONLY);
  
  //copy to clipboard
  OpenClipboard(NULL);
  EmptyClipboard();
  SetClipboardData(CF_BITMAP, hbmp);
  CloseClipboard();
  
  //release
  DeleteDC(hdc);
  DeleteObject(hbmp);
  ReleaseDC(NULL, hdcScreen);
  
  cout &lt;&lt; "success copy to clipboard, please paste it to the 'mspaint'" &lt;&lt; endl;
  </code></pre>
  
  <p>Thanks in advance.</p>