代码之家  ›  专栏  ›  技术社区  ›  H.J. Meijer

WPF中的主机qt应用程序

  •  0
  • H.J. Meijer  · 技术社区  · 8 年前

    我正在尝试在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);
    
    1 回复  |  直到 8 年前
        1
  •  0
  •   H.J. Meijer    8 年前

    答复: external App inside WPF (notepad.exe works but others don't) 简而言之,这是不可能的,因为大多数应用程序不支持OLE。