Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Controls
  New Posts New Posts RSS Feed - How to set Default Browser?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to set Default Browser?

 Post Reply Post Reply
Author
Message
shipwreck View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 April 2008
Location: United States
Status: Offline
Points: 308
Post Options Post Options   Thanks (0) Thanks(0)   Quote shipwreck Quote  Post ReplyReply Direct Link To This Post Topic: How to set Default Browser?
    Posted: 03 March 2009 at 7:14am
Hello Codejock Community!
I have question:
I'm working on a web browser using your web browser control, and I was wondering how can I implement the feature "Set as default browser" like alot of other web browsers do? Please help out. lol.
Product: Xtreme Suite Pro (Active-X), Version 15.3.1

Platform: Windows 7 Ultimate SP1 (64Bit) & Windows XP Mode SP3 (32Bit)

Language: Visual Basic 6.0 SP6
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 04 March 2009 at 3:41am
Hi,
 
Here code from our MFC StylerBrowser sample...
 
void SetDefault(LPCTSTR lpszKey, BOOL = TRUE)
{
 HKEY            hKey, hSubKey, hSubKey2;
 if(RegOpenKey(HKEY_CLASSES_ROOT, lpszKey, &hKey) == ERROR_SUCCESS)
 {
  DWORD dwRes;
  TCHAR lpszModule[_MAX_PATH];
  HINSTANCE hInstance = AfxGetInstanceHandle();
  
  RegSetValueEx(hKey, _T(""), NULL, REG_SZ, (LPBYTE)(_T("Styler")), 7 * sizeof(TCHAR));
  
  //open
  RegCreateKeyEx(hKey, _T("open"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,  &hSubKey, &dwRes);
  RegCreateKeyEx(hSubKey, _T("command"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,  &hSubKey2, &dwRes);
  
  if (GetModuleFileName(hInstance, lpszModule + 1, _MAX_PATH))
  {
   *lpszModule = _T('\"');
   #if (_MSC_VER > 1310) // VS2005
   _tcscat_s(lpszModule, _MAX_PATH, _T("\" \"%1\""));
   #else
   _tcscat(lpszModule, _T("\" \"%1\""));
   #endif
   RegSetValueEx(hSubKey2, _T(""), NULL, REG_SZ, (LPBYTE)(lpszModule), ((int)_tcsclen(lpszModule) + 1) * sizeof(TCHAR));
  }
  
  RegCloseKey(hSubKey);
  RegCloseKey(hSubKey2);
  
  
  //myie
  RegCreateKeyEx(hKey, _T("Styler"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,  &hSubKey, &dwRes);
  RegCloseKey(hKey);
  RegCreateKeyEx(hSubKey, _T("command"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,  &hKey, &dwRes);
  
  
  if (GetModuleFileName(hInstance, lpszModule+1, _MAX_PATH))
  {
   *lpszModule = _T('\"');
   #if (_MSC_VER > 1310) // VS2005
   _tcscat_s(lpszModule, _MAX_PATH, _T("\" \"%1\""));
   #else
   _tcscat(lpszModule, _T("\" \"%1\""));
   #endif
   RegSetValueEx(hKey, _T(""), NULL, REG_SZ, (LPBYTE)(lpszModule), ((int)_tcsclen(lpszModule) + 1) * sizeof(TCHAR));
   
  }
  
  RegCloseKey(hSubKey);
  RegCloseKey(hKey);
 }
}
 
void CMainFrame::OnSetDefault()
{
 SetDefault(_T("htmlfile\\shell"));
 SetDefault(_T("InternetShortcut\\shell"));
 SetDefault(_T("mhtmlfile\\shell"));
 SetDefault( _T("http\\shell"));
 SetDefault( _T("https\\shell"));
 SetDefault( _T("file\\shell"));
 SetDefault( _T("ftp\\shell")); 
}
 
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
shipwreck View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 April 2008
Location: United States
Status: Offline
Points: 308
Post Options Post Options   Thanks (0) Thanks(0)   Quote shipwreck Quote  Post ReplyReply Direct Link To This Post Posted: 04 March 2009 at 5:27am
I'm not familiar with MFC, any way to translate that into VB6?
Product: Xtreme Suite Pro (Active-X), Version 15.3.1

Platform: Windows 7 Ultimate SP1 (64Bit) & Windows XP Mode SP3 (32Bit)

Language: Visual Basic 6.0 SP6
Back to Top
dentor View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2005
Location: France
Status: Offline
Points: 102
Post Options Post Options   Thanks (0) Thanks(0)   Quote dentor Quote  Post ReplyReply Direct Link To This Post Posted: 05 March 2009 at 2:37am
Originally posted by shipwreck shipwreck wrote:

I'm not familiar with MFC, any way to translate that into VB6?
 
Hello Shipwreck,
 
Here's a link to a microsoft webpage that explain with vb6 code the way to :
 
Modify the default Web browser and e-mail client programmatically in Windows XP
 
 
Hoping it will be useful for you.
 
Product: Xtreme SuitePro (ActiveX) version 13.0.0
Platform: Windows XP (32bit) - SP 3
Language: Visual Basic 6.0 SP 6
Back to Top
shipwreck View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 April 2008
Location: United States
Status: Offline
Points: 308
Post Options Post Options   Thanks (0) Thanks(0)   Quote shipwreck Quote  Post ReplyReply Direct Link To This Post Posted: 05 March 2009 at 5:38am
Seems to be what I was looking for.
But, will this function work on Vista also?
or is there another for that?
Product: Xtreme Suite Pro (Active-X), Version 15.3.1

Platform: Windows 7 Ultimate SP1 (64Bit) & Windows XP Mode SP3 (32Bit)

Language: Visual Basic 6.0 SP6
Back to Top
dentor View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2005
Location: France
Status: Offline
Points: 102
Post Options Post Options   Thanks (0) Thanks(0)   Quote dentor Quote  Post ReplyReply Direct Link To This Post Posted: 05 March 2009 at 5:42am
I think there is no difference for the Vista version.
Product: Xtreme SuitePro (ActiveX) version 13.0.0
Platform: Windows XP (32bit) - SP 3
Language: Visual Basic 6.0 SP 6
Back to Top
shipwreck View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 April 2008
Location: United States
Status: Offline
Points: 308
Post Options Post Options   Thanks (0) Thanks(0)   Quote shipwreck Quote  Post ReplyReply Direct Link To This Post Posted: 05 March 2009 at 5:56am
Alrighty, I'll test to see.
Product: Xtreme Suite Pro (Active-X), Version 15.3.1

Platform: Windows 7 Ultimate SP1 (64Bit) & Windows XP Mode SP3 (32Bit)

Language: Visual Basic 6.0 SP6
Back to Top
shipwreck View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 April 2008
Location: United States
Status: Offline
Points: 308
Post Options Post Options   Thanks (0) Thanks(0)   Quote shipwreck Quote  Post ReplyReply Direct Link To This Post Posted: 10 December 2009 at 7:14am
Okay. Has anyone actually found a way to detect the default browser and how to change it using VB6?
Product: Xtreme Suite Pro (Active-X), Version 15.3.1

Platform: Windows 7 Ultimate SP1 (64Bit) & Windows XP Mode SP3 (32Bit)

Language: Visual Basic 6.0 SP6
Back to Top
dentor View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2005
Location: France
Status: Offline
Points: 102
Post Options Post Options   Thanks (0) Thanks(0)   Quote dentor Quote  Post ReplyReply Direct Link To This Post Posted: 10 December 2009 at 7:43am
Hello Shipwreck,
 
Default Web browser settings is stored in registry and you can find the registry entry for your default browser at :

HKEY_LOCAL_MACHINE\Software\Clients\StartMenuInternet
 
Default value indicate the default web browser.
 
Product: Xtreme SuitePro (ActiveX) version 13.0.0
Platform: Windows XP (32bit) - SP 3
Language: Visual Basic 6.0 SP 6
Back to Top
shipwreck View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 April 2008
Location: United States
Status: Offline
Points: 308
Post Options Post Options   Thanks (0) Thanks(0)   Quote shipwreck Quote  Post ReplyReply Direct Link To This Post Posted: 10 December 2009 at 8:37am
Long time no talk eh' dentor? How have you been?
Also, I need it to be able to recognize that on XP Vista, and Windows 7. Do you think you can give me a sample or a code listing? I'd really appreciate it. Like I said earlier, I'm still completely lost on this one. lol.
Product: Xtreme Suite Pro (Active-X), Version 15.3.1

Platform: Windows 7 Ultimate SP1 (64Bit) & Windows XP Mode SP3 (32Bit)

Language: Visual Basic 6.0 SP6
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.