Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: WinCom - bringing IE window  (Read 19029 times)
John T.
Posts: 14


« on: August 05, 2008, 02:31:13 am »

Hi,

Can anyone tell me how to how to launch IE using WinCom and bring the window to the forground.
I can only get it to open behind the GDC window.

The code I am using is:

call ui.Interface.frontCall("WinCOM", "CreateInstance", ["InternetExplorer.Application"], [ieapp])
call ui.interface.frontCall("WinCOM", "CallMethod", [ieapp, "Navigate2", url], [ie_result])
call ui.interface.frontCall("WinCOM", "SetProperty", [ieapp, "AddressBar", FALSE], [ie_result])
call ui.interface.frontCall("WinCOM", "SetProperty", [ieapp, "Visible", True], [ie_result])

Thanks for any help.

John
Lionel F.
Four Js
Posts: 83


« Reply #1 on: August 05, 2008, 11:07:48 am »

Hello John,

Using your code, I am able to launch the Internet Explorer window on the foreground.

In general, this type of issue is purely handled by the window manager of the operating system and we have usually no way to control this.

I'm not sure that there is any existing method which is able force that. On my side, I launch the command from a Menu. IE automatically takes the focus and, thus, is opened at the top. What is your Operating System? Windows XP?

Best regards,
Lionel

Ullrich M.
Posts: 11


« Reply #2 on: August 05, 2008, 12:21:25 pm »

Hi,
I have the same behaviour as John's: IE in the background.


This syntax lauches IE in the foreground

let url="www.adac.de"
let ieapp = "iexplore.exe" || " " ||  url

CALL ui.Interface.frontCall( "standard", "shellexec", [ieapp], [] )

Regards,
Umo
John T.
Posts: 14


« Reply #3 on: August 05, 2008, 11:26:09 pm »

Hi Umo,

We do use frontcall shellexec, and as you say it brings the IE window to the front.  However we wanted to use Wincom in the current piece of code because we can then control many aspects of how IE opens (no address bar, position, width etc).

Thanks for your reply.

John
Reuben B.
Four Js
Posts: 1116


« Reply #4 on: August 06, 2008, 12:29:01 am »

John,

Does this only occur for IE, or if you try to open Excel, Word, or Outlook at the same point in the code do they also open behind?

If all of them have the same behaviour it maybe something to do with the following registry setting...

http://support.microsoft.com/?kbid=886217.

As I understand it, it was introduced so that if you were working away in Word, you didn't have Outlook stealing the focus with the 'You have new mail, do you want to read it now' dialog.  So the registry setting prevents a window without the focus stealing the focus unless there has been x seconds of inactivity.  So if the GDC doesn't have the windows focus it can't steal the focus.

Reuben

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
John T.
Posts: 14


« Reply #5 on: August 06, 2008, 04:07:10 am »

Hi Lionel,

I am using:
WinXP Service Pack 3
GDC 2.11.03
BDL 2.11.02 on Windows 2003

Sometimes IE will open on top, and sometimes not.  Using Wincom with Word and Excel they always open on top.

Changing ForegroundLockTimeout in the registry seems to force IE to always open on top as Reuben suggested.

Thanks

John
John T.
Posts: 14


« Reply #6 on: August 06, 2008, 04:14:01 am »

Hi Reuben,

Word and Excel always open on top.  IE sometimes is on top and sometimes hidden.

When I change ForegroundLockTimeout to 0 as you suggested then IE always opens on top.  This is not perfect as we do not control all the machines using our code with the GDC, but it is a big help.

Regards,

John
.
Four Js
Posts: 115


« Reply #7 on: August 06, 2008, 08:31:43 am »

Actually, this question (bringing a window to the top) also concerns GDC windows too.

Concerning GDC windows, we call - on windows - SetWindowPos function. with parameter HWND_TOP (see http://msdn.microsoft.com/en-us/library/ms633545(VS.85).aspx), and SetForegroundWindow (see http://msdn.microsoft.com/en-us/library/ms633539(VS.85).aspx ) - actually Qt Library does it for us.

We assume that:
- this functions should work
- if not, the system is responsible for the failure and we can anyway not do anything. MSDN page regarding SetForegroundWindow indicates that the behavior of windows has changed in different versions, and todays versions have restrictions about it. We decided to not override the default behavior, as described in msdn.

In WinCOM / IE, this is even "simpler" from our side: we do not do anything to bring the application on the front. GDC knows nothing about the COM server, and has no control on it except the calls you do.


BTW, a general remark about winCOM: most of the questions we get regarding COM could be considered as "out of subject", as they concern more the COM server application than WinCOM extension itself. (ok, some questions are really related to the extension, for instance "I can do this with an EXCEL macro, but this does not work with WinCOM").
So this is why sometimes we're not able to provide you an answer, as we're unfortunately not expert with all COM servers.

Nevertheless, the forum is the right place to ask, because:
- maybe someone else here may have tried before
- we (four js) try to gather all the WinCOM questions and everything should be made available in the support area.

Regards,
Pierre-Nicolas
John T.
Posts: 14


« Reply #8 on: August 07, 2008, 01:07:18 am »

Hi Pierre-Nicolas,

Thanks for the clarification.  I had looked around the Web and noted that SetForegroundWindow should be called.  If that is already being done then it does not seem we can do much more.

It is not a big issue, but would be nice if the window always opened on top.

Thanks,

John
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines