Post Reply

Forums -> UltraMon™ SDK -> Issue when moving IExplorer to the next monitor when there is already IExplorer open
harrise   2011-11-07 20:09

We have been having some issues regarding moving the opened IExplorer window to the next monitor.

If there is no IExplorer open the code below works perfectly fine.

If there is already an IExplorer open behind the main application. the code below doesn't work.

The code is setting the correct monitor Id each time for the IExplorer to move to the next monitor. I couldn't see any problem with the code and also this was working fine yesterday and now its not?

'the main window of the application identified by processId has been assigned to the object
Dim sys As IUltraMonSystem = New ULTRAMONLib.UltraMonSystem
Dim mon As ULTRAMONLib.IUltraMonMonitor = Nothing

If sys.Monitors.Count > 1 Then
mon = sys.Monitors.Item(CStr(lngUltraMonScreenIndex))
Catch ex As Exception
mon = sys.Monitors.Item("1")
End Try

objUltraMonWindow.Monitor = mon.ID

blnResult = objUltraMonWindow.ApplyChanges(ULTRAMONLib.WNDCHANGE.WNDCHANGE_RESIZE_TO_FIT)
blnResult = True
End If

Any help or suggestion would be appreciated. The code is in VB.NET. We are using a COM Wrapper to call in VB6 as the main application is in VB6.

harrise   2011-11-07 22:18
Just to add, I already have a Find method before executing the code above.
Christian Studer   2011-11-08 09:04
The problem is that when you launch the second IE instance, the actual window gets created in a different process, but because UltraMon looks for the window in the original process this doesn't work.

The best way to do this is to use the IE COM object to create and position the new IE instance: add a reference to the Microsoft Internet Controls COM object to your project, then use code like this:'create UltraMon System and Internet Explorer objects Dim sys As IUltraMonSystem = New UltraMonSystem Dim ie As New SHDocVw.InternetExplorer 'get target monitor Dim mon As IUltraMonMonitor = sys.Monitors("2") 'position IE on that monitor, navigate to the desired website, and make the new IE instance visible ie.Left = mon.Left ie.Top = mon.Top ie.Navigate("") ie.Visible = TrueChristian Studer -
harrise   2011-11-08 18:42
it started working when I added a line of code below:
Dim bGet As Boolean = objUltraMonWindow.GetForegroundWindow()

before the line:

objUltraMonWindow.Monitor = mon.ID

it looks like it was losing a focus.

but i will also try the above suggestion.
harrise   2011-11-09 01:53
i manage to get this to work by adding the code below:

Dim bGet As Boolean = objUltraMonWindow.GetForegroundWindow()

it was losing the focus on the current open IEplorer.

All the changes I made including the flickering tweak works fine on my machine.

But for some odd reason all of this doesn't function properly on my colleagues PC, he has Ultramon installed both ( COM and the utility?)

I have also noticed that you have a VBScript from your website. Would it be worth trying the vbscript???

harrise   2011-11-09 01:54
I only have the Ultramon Components installed on my PC. I did not installed the Ultramon software (desktop)
Christian Studer   2011-11-09 06:51
I would recommend using the approach with the IE COM object, getting the foreground window after launching a new IE instance and then moving that is unreliable, depending on timing/other applications running you may get the correct window or not.

Christian Studer -
Forums -> UltraMon™ SDK -> Issue when moving IExplorer to the next monitor when there is already IExplorer open

Post Reply