0

First, let me explain my situation: In my Win32 app, I have a overlapped window whose HWND name is hwnd1. Now I create another overlapped window with the following code:

HWND hwnd2 = ::CreateWindowEx(0, L"classname", L"window_name",
                WS_OVERLAPPEDWINDOW, left, top, width, height,
                hwnd1, NULL, ::GetModuleHandle(NULL), NULL);

At first, I thought hwnd1 is hwnd2's parent window. But when I use "FindWindowEx" trying to find hwnd2 like below:

::FindWindowEx(hwnd1, nullptr, L"classname", L"window_name");

I can't find it. Then I discovered that hwnd1 is not hwnd2's parent but its owner. So "FindWindowEx" is invalid in this situation. How can I find hwnd2 when I know its owner and class name and window name?

MSalters
  • 173,980
  • 10
  • 155
  • 350
Cao Wei
  • 1
  • 1

0 Answers0