I’m trying to place a panda3D window inside a win form using c#. I was able to launch the process ppython file.py and I success opening the DOS console inside my form. But Unfortunatley the graphic whindow that opens later, doesn’t appear inside my form (MDI parent).
Process p = Process.Start("notepad.exe");
Thread.Sleep(500); // Allow the process to open it's window
SetParent(p.MainWindowHandle, panel1.Handle);
I’m able to reparent the consolde window, but not the Panda3d window. How can I have access to that “second” handle withou searching for all opened application on my system?
It will be cleanest if you let the Python code handle that reparenting: pass the value of pane1.Handle into your Python program, and let it be responsible for passing that to base.openWindow(), via the WindowProperties.setParentWindow() call. Alternatively, your Python program can preload that value as the “parent-window-handle” config variable, e.g. “parent-window-handle 3670896”, where 3670896 is the integer value of pane1.Handle.
A different approach would be to do more as you suggest: to let the Python program create its window normally, and then reparent it to your pane after it has been created. You can get the HWND of the created window by querying base.win.getWindowHandle().getIntHandle().