Page 1 of 1

find the default browser

Posted: Fri Oct 12, 2012 2:38 pm
by cvirus
Hello Admin is there a way to find what the default browser is? :D

Thanks

find the default browser

Posted: Fri Oct 12, 2012 3:05 pm
by cvirus
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

find the default browser

Posted: Fri Oct 12, 2012 3:57 pm
by Marco
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")

find the default browser

Posted: Fri Oct 12, 2012 8:34 pm
by cvirus
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

find the default browser

Posted: Sat Oct 13, 2012 4:17 pm
by Marco
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

find the default browser

Posted: Mon Oct 15, 2012 2:22 pm
by cvirus
[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.

find the default browser

Posted: Mon Oct 15, 2012 3:36 pm
by cvirus
This does not work on XP, because the regkey for the default browser is diferent :(.

find the default browser

Posted: Tue Oct 16, 2012 3:34 pm
by Marco
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

find the default browser

Posted: Wed Oct 17, 2012 9:09 am
by cvirus
[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

find the default browser

Posted: Wed Oct 17, 2012 3:19 pm
by Marco
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