I am attempting to run a XNA app with ShowWithoutActivation
so that it comes up without stealing focus.
I'm attempting to do this for an open-source branch of SurfaceToTUIO, which runs on the Microsoft Surface SDK built on XNA. The app I'm integrating with is not built on XNA, so I'm not able to combine the two.
I'm new to forms, but have made some headway. I'm able to get the form from of the application with:
Form form = (Form)Form.FromHandle(Window.Handle);
From there set ShowInTaskbar
to false, set its FormBorderStyle
to FixedToolWindow
, and SetDesktopBounds
to offscreen.
ShowWithoutActivation
can't be set directly, as it can only be overridden by a subclass. I can tell that XNA creates the Window that I'm extracting the form from, but that seems to happen behind the scenes.
I'm guessing I can use reflection to rewrite the method on the form's ShowWithoutActivation
method, but its hackish and I'm not sure it will run in time to make a difference. I'm not sure if I can set my own subclassed form in XNA - Application.Run()
can take a form, but a subclass of Microsoft.Xna.Framework.Game
cannot.
I think I'm close to having SurfaceToTUIO run as a process the user can be ignorant of, but I'm not sure what is possible with this final step. What should I do?
Thanks!