find the default browser

In this category you can exchange your programming questions and solutions.
Post Reply
cvirus
Posts: 88
Joined: Tue Jan 12, 2010 8:33 pm

find the default browser

Post: # 979Post cvirus
Fri Oct 12, 2012 2:38 pm

Hello Admin is there a way to find what the default browser is? :D

Thanks

cvirus
Posts: 88
Joined: Tue Jan 12, 2010 8:33 pm

find the default browser

Post: # 980Post cvirus
Fri Oct 12, 2012 3:05 pm

Thru the reg is "HKEY_CURRENT_USERSoftwareMicrosoftWindowsShellAssociationsUrlAssociationshttpUserChoiceProgid"

In my Pc it returns the FirefoxURL for firefox, now i have to compare this and tell the program to run firefox.

For the IE it returns IE.HTTP

Marco
Site Admin
Posts: 246
Joined: Sat Sep 15, 2018 8:41 pm

find the default browser

Post: # 981Post Marco
Fri Oct 12, 2012 3:57 pm

can you do it whit this?

`open default browser
if fileexists("blank.html")=false then
  dim f as filestream
  f.open("blank.html")
  f.close
end if

best regards
open("blank.html")

cvirus
Posts: 88
Joined: Tue Jan 12, 2010 8:33 pm

find the default browser

Post: # 982Post cvirus
Fri Oct 12, 2012 8:34 pm

Hello admin, thanks for the reply, but what i want is to see what is the default brawser so i could run some links without using, lets say, allways the internet explorer.

The only thing i need to know now is the reg progid of chrome.

Thanks :D

Marco
Site Admin
Posts: 246
Joined: Sat Sep 15, 2018 8:41 pm

find the default browser

Post: # 983Post Marco
Sat Oct 13, 2012 4:17 pm

Hi, can you do it with this code?

dim reg as registry
dim browser as string

browser= reg.readkey("HKEY_CLASSES_ROOThtmlfileshellopencommand")
browser=browser-chr$(34)
browser=left$(browser,instr(browser,".")+4)
showmessage browser
shell(browser)

best regards

cvirus
Posts: 88
Joined: Tue Jan 12, 2010 8:33 pm

find the default browser

Post: # 984Post cvirus
Mon Oct 15, 2012 2:22 pm

[quote author=7471787C7B150 link=1350052683/4#4 date=1350145031]Hi, can you do it with this code?

dim reg as registry
dim browser as string

browser= reg.readkey("HKEY_CLASSES_ROOThtmlfileshellopencommand")
browser=browser-chr$(34)
browser=left$(browser,instr(browser,".")+4)
showmessage browser
shell(browser)

best regards[/quote]

That code gives me allways the internet explorer, i did it like this:

[code]
dim reg as registry
dim key as string
` for the default web browser
key="HKEY_CURRENT_USERSoftwareMicrosoftWindowsShellAssociationsUrlAssociationshttpUserChoiceProgid"

dim path as string
path=reg.readkey(key)
`for the program files folder
dim reg1 as registry
dim key1 as string
key1="HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionProgramFilesDir"
dim path1 as string
path1=reg.readkey(key1)
` see if is internet explorer
if path ="IE.HTTP" then
run path1+"Internet Exploreriexplore.exe","www.facebook.com",3
End if
if path ="FirefoxURL" then
run path1+"Mozilla Firefoxfirefox.exe","www.facebook.com",3
end if
if path="ChromeHTML" then
run path1+"GoogleChromeApplicationchrome.exe","www.facebook.com",3
End if
[/code]

It works well in Seven, must test it in xp. :D

Thanks for the help.

cvirus
Posts: 88
Joined: Tue Jan 12, 2010 8:33 pm

find the default browser

Post: # 985Post cvirus
Mon Oct 15, 2012 3:36 pm

This does not work on XP, because the regkey for the default browser is diferent :(.

Marco
Site Admin
Posts: 246
Joined: Sat Sep 15, 2018 8:41 pm

find the default browser

Post: # 986Post Marco
Tue Oct 16, 2012 3:34 pm

Maybe this will do ???
best regards

``get default browser
declare FindExecutable as "FindExecutableA" of "shell32.dll"
lpFile As String
lpDirectory As String
lpResult As String byaddress
end declare

function getdefaultbrowser as string
dim f as filestream
f.open("htmpl.htm")
f.close
FindExecutable.lpfile="htmpl.htm"
FindExecutable.lpDirectory=exepath
FindExecutable.execute
result=FindExecutable.lpresult
kill "htmpl.htm"
end function

showmessage getdefaultbrowser

cvirus
Posts: 88
Joined: Tue Jan 12, 2010 8:33 pm

find the default browser

Post: # 987Post cvirus
Wed Oct 17, 2012 9:09 am

[quote author=4C494044432D0 link=1350052683/7#7 date=1350401690]Maybe this will do ???
best regards

``get default browser
declare FindExecutable as "FindExecutableA" of "shell32.dll"
lpFile As String
lpDirectory As String
lpResult As String byaddress
end declare

function getdefaultbrowser as string
dim f as filestream
f.open("htmpl.htm")
f.close
FindExecutable.lpfile="htmpl.htm"
FindExecutable.lpDirectory=exepath
FindExecutable.execute
result=FindExecutable.lpresult
kill "htmpl.htm"
end function

showmessage getdefaultbrowser
[/quote]


Yes that works very good, can you care to explain a bit?

Thanks :D

Marco
Site Admin
Posts: 246
Joined: Sat Sep 15, 2018 8:41 pm

find the default browser

Post: # 988Post Marco
Wed Oct 17, 2012 3:19 pm

yes, it creates a temporalely html file then look with an api call of windows with what execute it will be opened. Then it shows the path and name of that executable and erase (kill) the temp file.
The windows functioncall is findexecutable.
best regards

Post Reply