Function can't open a browser processes in TD5.2

Discussion forum about all things Team Developer 5.x and 6.x
User avatar
benedikz
Czech Republic
Posts: 14
Joined: 04 Nov 2021, 06:03
Location: Šumperk, Czech Republic

Function can't open a browser processes in TD5.2

Post by benedikz » 04 Nov 2021, 07:16

Hello everyone,

I've encountered a problem trying to call any browser processes via available functions in TD 5.2. My objective is to open a browser with pre-specified URL and input from a data field, however all functions I've tried don't seem to work for me and at this point I can only think about how to come across this issue.
I've nearly accomplished my goal using

Code: Select all

SalLoadApp('iexplore.exe', 'http://samplewebsite.anything/anything/searchwith.php?code=' || dfInput)
, however this function only seems to work on processes like notepad.exe & cmd.exe. All other browser processes have not been started via this function.

I'd really appreciate any help or idea why that might be,
Thanks, Tom

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 3437
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: Function can't open a browser processes in TD5.2

Post by Dave Rabelink » 04 Nov 2021, 08:12

Have a look at ShellExecute.
I would not advice to force a specific Webbrowser to open webpages. A system can have a different default browser.
(and for internet explorer, that one is dead).

Better to open a webpage by starting the default browser on that system which could be anything.

Using ShellExecute you can start any default application which depends on the type of "data" or parameter you pass in.

Code: Select all


ShellExecute(0, "open", server_url,NULL, NULL ,SW_SHOWNORMAL)
There is a TD WIKI sample implementing this and also shows how to manage opening applications which are not defined as default on the system

https://wiki.tdcommunity.net/index.php/ ... extensions

In your case just type the url in the datafield and press the button. It will open the url in the default browser.

If you really must open it in Internet Explorer, my guess why it fails is you need to pass in the full path to the iexplorer application to start it.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Michael Ehehalt
Germany
Posts: 73
Joined: 13 Mar 2017, 09:17
Location: Frankfurt, Germany

Re: Function can't open a browser processes in TD5.2

Post by Michael Ehehalt » 04 Nov 2021, 08:37

Hello Tom,

as Dave writes the better way is to use the ShellExecute function. The problem with your source code is that the programs CMD.EXE and NOTEPAD.EXE are in the system path, but IEXPLORE.EXE is not.

If you modify your source code to specify the full program path of IEXPLORE.EXE it will work:

Code: Select all

Call SalLoadApp( "C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe", 'http://samplewebsite.anything/anything/searchwith.php?code=' || dfInput)
Best regards,
Michael Ehehalt

User avatar
benedikz
Czech Republic
Posts: 14
Joined: 04 Nov 2021, 06:03
Location: Šumperk, Czech Republic

Re: Function can't open a browser processes in TD5.2

Post by benedikz » 04 Nov 2021, 09:28

Michael & Dave, thank you both for much appreciated help.

I've admitted that it would not be good practice to hardcode a specific webbrowser into my solution, so instead I just left it blank for the system to decide.
I took a look at ShellExecuteA from shell32.dll and can confirm, that using ShellExecute has solved my issue. However you explained to me as a bonus why my previous attempt did not work.

Thank you and have a great day :)
Tom

willkf25
Brazil
Posts: 3
Joined: 20 Apr 2021, 21:32
Location: Maringá-PR -Brazil

Re: Function can't open a browser processes in TD5.2

Post by willkf25 » 02 Mar 2022, 00:24

Use explorer.exe to open a url. The windows will use the default app to open a HTTP protocol...

code like this:

Code: Select all

Call SalLoadApp("explorer.exe","http://www.google.com")
Regarts

Return to “General Discussion TD 5.x and 6.x”

Who is online

Users browsing this forum: [Amazon], [Ccbot] and 0 guests