Open a webpage

Startbeitrag von Bart VDE am 24.04.2013 16:28


In a Windev application I want to open a webpage when clicking on a button.

Button code is :

ShellExecute("";) => OK, browser opens the page.

When the user clicks for a second time on the button, a second page is opened in a new tab in the browser.

What I want is that the page that is already opened gets the focus, not opening a new page.

Is that possible ?



Hi Bart

I don't see any easy way... What you can do:
1. instead of doing a shellexecute, you could use an activeX control inside your application to display the page (with the IE activeX)... At this point, you know what is displayed and you can give focus to it again...

2. If you need the external browser, then you would need to do the following:
- find out WHICH browser was open (ie what is the default browser on any machine)
- find out if the browser is still open when the user click a second time
- find out if the desired page is still displayed in the browser. As there can be several instances of the browser open with several tabs in each, this one may be a dousy
- then set the focus on the proper tab of the proper instance of the browser

I wouldn't want to try to achieve 2

Best regards

von Fabrice Harari - am 24.04.2013 18:08
Hi Fabrice,

thanks for the reply. I was afraid that this shouldn't be easy to do...

I'm gonna try a workaroud, I'm not sure if I can get this to work :

aHandle = SysWinHandle() to get a handle to the browser window, assuming the title of the browser window = xxxxx when the desired webpage is the active page in the browser

If aHandle = Null -> open the webpage
SysSetFocus(aHandle) to set the focus to the browser

von Bart VDE - am 25.04.2013 13:07
Zur Information: hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.