A problem about GetWindowHandle()

Hello everyone:
Now, I have a problem with the method GetWindowhandle(). I do this:

1.I create a window in windows vs2010 and layout some buttons and lables
2.I also create a documentwindow in the MainWindow to show video
3.but when i use GetWindowHandle() to get the HWND of the child documentwindow, I find that the Hwnd is same with the HWnd of the MainWindow.

now ,i want to put a window as the child component of the mainwindow. At the same time i want get the hwnd of the child component, not the parent hwnd.

so anyone can help me how to get it !

Thanks !

If you embed juce components inside each other, they’re lightweight objects, they don’t have different HWNDs…

Thanks for your reply, and i have two questions.

1.eg MFC, QT, Win32 etc, we can embed window inside each other,why juce can’t do this.

2.If we want embed a child window inside another main window, and render video or audio in the child window by the way of getting the child window hwnd. so how can we do this?

It can do this. You can use Component::addToDesktop to force a component to create itself as a heavyweight window either on the desktop or inside another window. You can do that yourself, but there are also helper classes that use the same mechanism, e.g. DirectShowComponent

If i understand correctly, If addToDesktop() is used, embeeded component is not tied to parent window anymore (for example, when moving parent window) !?! At least on Windows.

EDIT: i didn’t understand it correctly :slight_smile: