Skip to Content
avatar image
Former Member

HyperlinkToURL not working correctly

I am using HyperlinkToURL and it is not bringing up the default browser, instead it is using Internet Explorer.

I am using PB 10.5 and on Windows 10 it uses IE rather than the default browser which is Chrome. On Windows 7 it is using Chrome.

The URL i am passing is:

ls_SearchURL = '"? ' + ls_SearchValue + '"'

Passing "? searchterm" is a standard way to tell the browser to pass searchterm to the default search website.

It has been suggested to do this:

Run("rundll32.exe url.dll,FileProtocolHandler http://www.google.com/search?q=searchterm")

The problem with this method is that I have to know the URL of the default search website.

Any suggestions would be appreciated.

Thanks!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jan 31, 2017 at 10:59 PM

    I have the same sort of problem - my default browser is IE, but any hyperlinks done from PB programs always open in Chrome. Somehow PB must have its own notion of what the default browser is, or uses some incorrect lookup.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 01, 2017 at 04:10 PM

    Add the below function to an object and then call it like this:

    of_WebBrowse("? " + ls_SearchValue)

    public subroutine of_webbrowse (string as_urlstring);String ls_regkey, ls_value, ls_command
    Long ll_pos
    
    // get the default browser
    ls_regkey = "HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\" + &
    				"Associations\UrlAssociations\http\UserChoice"
    RegistryGet(ls_regkey, "Progid", RegString!, ls_value)
    
    // get the browser command line
    ls_regkey = "HKEY_CLASSES_ROOT\" + ls_value + "\shell\open\command"
    RegistryGet(ls_regkey, "", RegString!, ls_value)
    
    // append the passed URL string to the browser exe
    ll_pos = LastPos(ls_value, ".exe") + 4
    ls_command = Left(ls_value, ll_pos) + ' "' + as_urlstring + '"'
    
    Run(ls_command)
    end subroutine
    
    Add comment
    10|10000 characters needed characters exceeded