Page 1 of 1

Default Browser

PostPosted: July 20th, 2004, 9:35 am
by Kambiz
Does anybody know how can I set the default browser to my own application?

Any help would be appreciated.

Cheers,
Kambiz

PostPosted: July 20th, 2004, 6:38 pm
by Johnny_Bit
God... i tried to deal with it half year ago & what i know for shure is that it's stored in registry in direct InternetExplorer Settings or it has to deal with extension of html files, the way you can search for it is to set as default browser som non-standard browser and search in registry for values=path of that browser... i'm sure it was working with default editor.

PostPosted: July 21st, 2004, 7:05 am
by Kambiz
I know where XP keeps the list of installed browsers, and I can add my browser to the list and set it as default. Also, I have no problem on associating relative file types to my application.

However, I couldn't find yet how to associate my browser to the URLs. :(

PostPosted: July 21st, 2004, 10:11 am
by Kambiz
I found the answer.

The association for the protocols is as same as file types.

PostPosted: July 25th, 2004, 4:28 pm
by Johnny_Bit
Can You show me where's it's stored, and how to get/set it?

PostPosted: July 25th, 2004, 10:46 pm
by Kambiz
The following is the Inno Setup script I wrote for this purpose.

Code: Select all
[Tasks]
Name: DefaultBrowser; Description: Set QualiWEB Pro as your default &browser

[Registry]

; --- Start Menu Internet

Root: HKLM; SubKey: SOFTWARE\Clients\StartMenuInternet\QWP.EXE; ValueType: string; ValueData: QualiWEB Pro; Flags: uninsdeletekey noerror; Check: StartMenuInternetExists

Root: HKLM; SubKey: SOFTWARE\Clients\StartMenuInternet\QWP.EXE\DefaultIcon; ValueType: string; ValueData: """{app}\QWP.EXE"",0"; Flags: uninsdeletekey noerror; Check: StartMenuInternetExists

Root: HKLM; SubKey: SOFTWARE\Clients\StartMenuInternet\QWP.EXE\shell\open\command; ValueType: string; ValueData: """{app}\QWP.EXE"""; Flags: uninsdeletekey noerror; Check: StartMenuInternetExists

Root: HKCU; Subkey: SOFTWARE\Clients\StartMenuInternet; ValueType: string; ValueData: QWP.EXE; Flags: uninsdeletevalue noerror dontcreatekey; Tasks: DefaultBrowser; Check: StartMenuInternetExists

; --- End of Start Menu Internet

; --- Protocol & File Type Associations

Root: HKCR; Subkey: http\shell\open\command; ValueType: string; ValueData: """{app}\QWP.EXE"" %1"; Flags: uninsdeletevalue noerror dontcreatekey; Tasks: DefaultBrowser

Root: HKCR; Subkey: http\shell\open\ddeexec; ValueType: none; Flags: noerror dontcreatekey deletekey; Tasks: DefaultBrowser

Root: HKCR; Subkey: https\shell\open\command; ValueType: string; ValueData: """{app}\QWP.EXE"" %1"; Flags: uninsdeletevalue noerror dontcreatekey; Tasks: DefaultBrowser

Root: HKCR; Subkey: https\shell\open\ddeexec; ValueType: none; Flags: noerror dontcreatekey deletekey; Tasks: DefaultBrowser

Root: HKCR; Subkey: htmlfile\shell\open\command; ValueType: string; ValueData: """{app}\QWP.EXE"" %1"; Flags: uninsdeletevalue noerror dontcreatekey; Tasks: DefaultBrowser

Root: HKCR; Subkey: htmlfile\shell\opennew\command; ValueType: string; ValueData: """{app}\QWP.EXE"" %1"; Flags: uninsdeletevalue noerror dontcreatekey; Tasks: DefaultBrowser

; --- End of Protocol & File Type Associations

[_code]
function StartMenuInternetExists: Boolean;
begin
  Result := RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Clients\StartMenuInternet');
end;


Consider that because for sending a URL to a running instance of the application, I don't use DDE, I've deleted the related registry entry to perevent Windows error message.

Hope that it helps.
Kambiz