|Neutro 2005-01-14 01:53
I'm creating an application on a system with 6 monitors. My program runs on monitor 1 and has about 10 buttons to start other applications. Every application has a poperty to indicate on which monitor to start: i.e. button 4 start notepad on monitor 6.
So, when I now start an application, it first opens on monitor 1 and then it's moved to another one, like 6 in teh example. That's actually not what we want, we want the application to start immediately at the right monitor.
From what I read, I suppose this is the normal way with Ultramon but I was wondering if there is a work-around for this problem, so that people using my application, don't notice this and they only see the application open on the right screen.
Any help would be much appreciated because our customers are pretty critical and don't like such things.
Thanks in advance.
|Christian Studer 2005-01-14 02:52
If you control what applications will get launched, you could launch them hidden, search for the main window based on window title and/or class name, and move and show the window.
This way the window will appear only on the destination monitor.
Here's some sample code:
Set util = CreateObject("UltraMon.Utility")
If util.Run("C:\Program Files\Internet Explorer\iexplore.exe", SHOWSTATE_HIDDEN) = True Then
Set wnd = CreateObject("UltraMon.Window")
If wnd.Find("* - Microsoft Internet Explorer", "", FINDWND_TITLE, util.ProcessId, 5000) = True Then
wnd.Monitor = 2
wnd.Visible = True
wnd.ApplyChanges WNDCHANGE_RESIZE_TO_FIT Or WNDCHANGE_CLIP_TO_WORKSPACE
For a simple application like Notepad, which only creates a single top-level window, you don't need to specify window title or class, just call Find like this:
wnd.Find("", "", 0, util.ProcessId, 5000)
Please note that hiding the application initially might not work with all applications, the application can choose to ignore the initial showstate.
Christian Studer - www.realtimesoft.com