will place the executable path of the default browser in szValue.
Achieving remote control of the browser is a huge subject and will depend upon which browser(s) you want to work with. In the case of Internet Explorer, I suggest you look up IWebBrowser2 in the MSDN documentation in order to get started.
Re: How to get the default web browser path from registry?
C code to get the Default Browser path from the Registry
DWORD dwBufferSize255=255;
DWORD dwBufferSize855=855;
HKEY hKey;
char szDefaultBrowserExecutableFileName[255];
char szHKEY_LOCAL_MACHINEsubkey[455];
char szDefaultBrowserPathAndExecutableFileName[855];
// first get the current Default Browser path
// use Command Prompt...regedit.... to view registry
if ( RegOpenKeyEx ( HKEY_CURRENT_USER,
"software\\clients\\StartMenuInternet",
0, // reserved
KEY_ALL_ACCESS,
&hKey)
!=
ERROR_SUCCESS )
begin
MessageBox (hwnd,
"I was unable to find a StartMenuInternet in the Registry \
\r\n Trying Internet Explorer",
"Registry ERROR.",
MB_ICONINFORMATION | MB_OK );
strcpy ( szDefaultBrowserExecutableFileName, "iexplore.exe" ); // have to try iexplore
end
else if ( RegQueryValueEx ( hKey,
NULL, // take first unnamed value name
0, // reserved
NULL, // should be REG_SZ data type, ignore
szDefaultBrowserExecutableFileName,
&dwBufferSize255)
!=
ERROR_SUCCESS )
begin
MessageBox (hwnd,
"I was unable to find a Default Browser Name in the Registry \
\r\n Trying Internet Explorer",
"Registry ERROR.",
MB_ICONINFORMATION | MB_OK );
strcpy ( szDefaultBrowserExecutableFileName, "iexplore.exe" ); // have to try iexplore
if ( RegOpenKeyEx ( HKEY_LOCAL_MACHINE,
szHKEY_LOCAL_MACHINEsubkey,
0, // reserved
KEY_ALL_ACCESS,
&hKey)
!=
ERROR_SUCCESS )
begin
MessageBox (hwnd,
"I was unable to find the designated KEY_LOCAL_MACHINE \
StartMenuInternet in the Registry \
\r\n Trying C:\\Program Files\\Internet Explorer\\iexplore.exe",
"Registry ERROR.",
MB_ICONINFORMATION | MB_OK );
else if ( RegQueryValueEx ( hKey,
NULL, // take first unnamed value name
0, // reserved
NULL, // should be REG_SZ data type, ignore
szDefaultBrowserPathAndExecutableFileName,
&dwBufferSize855)
!=
ERROR_SUCCESS )
begin
MessageBox (hwnd,
"I was unable to find the designated KEY_LOCAL_MACHINE \
Default Browser Path in the Registry \
\r\n Trying C:\\Program Files\\Internet Explorer\\iexplore.exe",
"Registry ERROR.",
MB_ICONINFORMATION | MB_OK );
Re: How to get the default web browser path from registry?
I agree with GCDEF.
Besides, dear tewing54, you should have first read the Announcement: Before you post.... before posting your absolutely unreadable code.
Bookmarks