Default Browser

Please discuss general Delphi programming topics here.

Default Browser

Postby Kambiz » July 20th, 2004, 9:35 am

Does anybody know how can I set the default browser to my own application?

Any help would be appreciated.

Cheers,
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby Johnny_Bit » July 20th, 2004, 6:38 pm

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.
Johnny_Bit
VIP Member
VIP Member
 
Posts: 455
Joined: June 15th, 2003, 9:56 am

Postby Kambiz » July 21st, 2004, 7:05 am

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. :(
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby Kambiz » July 21st, 2004, 10:11 am

I found the answer.

The association for the protocols is as same as file types.
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby Johnny_Bit » July 25th, 2004, 4:28 pm

Can You show me where's it's stored, and how to get/set it?
Johnny_Bit
VIP Member
VIP Member
 
Posts: 455
Joined: June 15th, 2003, 9:56 am

Postby Kambiz » July 25th, 2004, 10:46 pm

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
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 2 guests

cron