wpf - HwndHost doesn't display content when Desktop Composition is enabled -


i'm using hwndhost embed external application in wpf window. noticed on windows 7 machines, if aero theme selected , desktop composition enabled, external application starts, flickers on screen split second , disappears. if turn off desktop composition or use basic theme, application embedded inside wpf window.

this code use in class derived hwndhost:

[dllimport("user32.dll", setlasterror = true)] private static extern intptr setparent(intptr hwndchild, intptr hwndnewparent);  [dllimport("user32.dll", setlasterror = true)] private static extern int setwindowlong(intptr hwnd, int nindex, int dwnewlong);  private const int gwl_style = (-16); private const int ws_child = 0x40000000; private const int ws_ex_appwindow = 0x00040000;  [dllimport("user32.dll", setlasterror = true)] private static extern bool showwindow(intptr hwnd, int ncmdshow);  protected override handleref buildwindowcore(handleref hwndparent) {     while (process.mainwindowhandle == intptr.zero)     {         process.refresh();         system.threading.thread.sleep(10);     }      setlasterror(0);     var ret = setwindowlong(process.mainwindowhandle, gwl_style, ws_child);     int e1 = marshal.getlastwin32error();     setparent(process.mainwindowhandle, hwndparent.handle);     int e2 = marshal.getlastwin32error();     showwindow(process.mainwindowhandle, 0);     int e3 = marshal.getlastwin32error();     return new handleref(this, process.mainwindowhandle); } 

i don't windows errors when issue occurs. process starts window injects class. i've checked task manager , process runs it's not visible inside wpf window. thoughts?

look @ system addin namespace how can use native hwind_ptr control. don't need use of library work.

https://docs.microsoft.com/en-us/dotnet/framework/wpf/app-development/wpf-add-ins-overview


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -