Activator.CreateInstance

barski

Junior Contributor
Joined
Apr 7, 2002
Messages
240
Location
Tennessee
i use activator to startup a third party exe let's call it widget. i invoke a few methods and pass args to widget the close widget... all works well

except how can i keep widget running in the background instead of becoming the "main' window everytime a method is invoked?
 
So, the application opens its own window? When you say "main" window, do you mean that it becomes a parent window, recieves focus, appears on the task bar, becomes topmost ("stay on top")...? I think you need to elaborate a little on what is going on here. The solution probably lies in the realm of threading, app domains, or method of invocation, rather than method of instantiation.
 
thanks for the reply. By main window i mean it becomes the topmost window not just of the application that is calling but of anything that may be running.

specifically, the applcation has a thread that every 15 minutes checks a location on the network fileserver and if certain files are there it does x, y, z. Include in the x, y, z is a call to another application and as soon as
createinstance is called boom it's the topmost window even if the user is in something like IE or word. as you may guess there's no way i can deploy the app with it working this way. As stated above it is being called in a separate thread from app however I'm far from a expert on threading so there may be something i've set wrong in the process.

so far the best i've come up with is importing the user32.dll and hiding the window with ShowWindow(). however there's still a flicker since i can't get the handle until the window is created.
 
I think i've figured it out. It will be a couple of days before i actually try it but i think if i use ShellExecute to open the window with a hide arg
instead of CreateInstance i will be able to remove the flicker...

if anyone has a better idea please suggest it!
 
Back
Top