c# - SetParent of window before the window opened -
i using setparent
host external app in app (using windowsformhost
).
flow that:
- i open app
- i open external app
programmaticly
- i use setparent host within app.
due flow above, when external app opens, can see in taskbar/task manager split second (until parent set).
can somehow change order first set parent , open app? want avoid described..
if have other solution problem gladly accept it.
edit:
code
string strpres = @"c:\users\ron\desktop\create office mix.pptx"; oppt = new microsoft.office.interop.powerpoint.application(); oppt.visible = microsoft.office.core.msotristate.msotrue; objpresset = oppt.presentations; objpres = objpresset.open(strpres, msotristate.msofalse, msotristate.msofalse, msotristate.msotrue); objpres.slideshowsettings.showtype = microsoft.office.interop.powerpoint.ppslideshowtype.ppshowtypewindow; objpres.slideshowsettings.run(); objpres.windows[1].close(); objpres.saved = msotristate.msotrue; uint opptid; getwindowthreadprocessid(new intptr(oppt.hwnd), out opptid); _process = process.getprocessbyid((int)opptid); _process.waitforinputidle(); setparent(_process.mainwindowhandle, _panel.handle);
you can't call setparent() until know window handle. app creating window inevitably causes taskbar button created, no way override this. processstartinfo.windowstyle could workaround when ask hidden, except vast majority of apps ignore request.
you can quick , use same mechanism shell uses notice window getting created. , ahead of it, requires setwindowshookex(). painful .net app, wh_shell hook requires dll can injected process can't written in c#. there's codeproject.com project helps, located here. quite dated, ymmv.
Comments
Post a Comment