我正在尝试在windowsforms/wpf应用程序中托管QT应用程序的窗口。我已经看到了很多关于这个问题的问题和答案。但它们对我不起作用(该窗口不会显示在wpf表单中,并保持自己的运行)。
我有一个应用程序,必须在windows上以管理员模式启动。当我尝试使用SetParent在应用程序中嵌入/托管它时,它不会显示,SetParent返回0。
其他应用程序(如记事本+)也可以运行,我是否需要执行其他步骤来托管管理员模式窗口?
编辑1:
int h = FindWindow(null, "Game Browser");
IntPtr hwnd = (IntPtr)h;
// Both h and hwnd are set to correct values
var helper = new WindowInteropHelper(this);
var x = SetParent(hwnd, helper.Handle);
// x remains 0, helper.Handle returns a seemingly correct value
// remove control box
int style = GetWindowLong(hwnd, GWL_STYLE);
style = style & ~WS_CAPTION & ~WS_THICKFRAME;
SetWindowLong(hwnd, GWL_STYLE, style);