473,657 Members | 2,351 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Determining system default web browser from Windows Forms app

Logan1337
38 New Member
Hi. I know about System.Diagnost ics.Process.Sta rt( url ) to launch a url in the default web browser, but I'm wondering if it's possible to actually get a path to the actual executable that is set as the default browser.

In particular, I want to grab this file's icon to use in a menu item.

Logan
Jun 26 '07 #1
3 1524
shweta123
692 Recognized Expert Contributor
Hi,

You can try this function to get the path of default browser
Expand|Select|Wrap|Line Numbers
  1.  Public Shared Function DefaultBrowserPath() As String
  2.         'Dim Key As RegistryKey
  3.         Dim Key As RegistryKey
  4.  
  5.         Try
  6.             Key = Registry.ClassesRoot.OpenSubKey(Name:="HTTP\\shell\\open\\command", Writable:=False)
  7.  
  8.             Dim Path As String = CStr(Key.GetValue(Nothing)).ToLower.Replace("""", "")
  9.  
  10.             If Not Path.EndsWith(".exe") Then
  11.                 Path = Path.Substring(0, Path.LastIndexOf(".exe") + 4)
  12.             End If
  13.  
  14.  
  15.         Finally
  16.             If Not Key Is Nothing Then Key.Close()
  17.         End Try
  18.  
  19.     End Function
  20.  

Hi. I know about System.Diagnost ics.Process.Sta rt( url ) to launch a url in the default web browser, but I'm wondering if it's possible to actually get a path to the actual executable that is set as the default browser.

In particular, I want to grab this file's icon to use in a menu item.

Logan
Jun 26 '07 #2
Logan1337
38 New Member
Perfect! Thanks.

Now the trick is to figure out how to get the executable's icon...
Jun 26 '07 #3
Logan1337
38 New Member
Now the trick is to figure out how to get the executable's icon...
Done. For future reference, research SHGetFileInfo.

-Logan
Jun 26 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
4950
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my webserver runs that part of the script (see attached file, snippet.php), though, it doesn't go through. I don't get an error message or anything...it just returns a "1" (whereas it should return a "0") as far as I can tell. I have read the PHP...
2
16197
by: Phil Stanton | last post by:
When designing a new form or report, the Default ForeColor is often something like -2147483640 which is the colour of Windows text (possibly black) and the default backColor is -2147483643 (possibly white) Can anyone tell me how to convert these colours to either RGB colours or the Long number used by Access. Black is 0 and White is 16777215 ...
1
4019
by: Rhy Mednick | last post by:
I'm creating a custom control (inherited from UserControl) that is displayed by other controls on the form. I would like for the control to disappear when the user clicks outside my control the same way a menu does. To do this my control needs to get notified when the user tried to click off of it. The Leave and LostFocus events of the UserControl work most of the time but not always. For example, if they click on a part of the form...
36
2469
by: AussieRules | last post by:
Hi, I want to use the user color scheme to set the color of my forms. I now I have to use the. System.Drawing.SystemColors, but which color is the color of a form background as used in other applications. In the end all I want to do is form1.backcolor = system.whatever.color
1
10248
by: lcifers | last post by:
I have an application that uses the following code to return the default printer: Dim moReturn As Management.ManagementObjectCollection Dim moSearch As Management.ManagementObjectSearcher Dim mo As Management.ManagementObject moSearch = New Management.ManagementObjectSearcher("Select * from Win32_Printer")
11
5620
by: John McMonagle | last post by:
Is there a python module which can determine an operating system's default web browser application. I would like to use it in the following context: I have a GUI application where all the documentation is written as html pages. I wish to have these html help pages open in the default browser when selected from the application's Help menu If python can determine the path to the default browser, I can then just spawn it.
4
11110
by: Liverpool fan | last post by:
I have a windows application written using VB .NET that encompasses a countdown timer modal dialog. The timer is a System.Timers.Timer with an interval of 1 second. AutoReset is not set so accepts the default of True. The Elapsed event handler updates the dialog box with how long before it will close, acting as a timer itself. The dialog has a time to close property which is checked every time the Elapsed event fires. The problem I have...
1
2488
by: euroluxantiques | last post by:
Hi All, Using VB.Net with SQL Server. I have a form that I create a number of Picture Boxes on dynamically, based on a stored procedure that retrieves a listing of images available for a particular product and populates the picture boxes using the paths found by the stored procedure. Anyway, that part works great. I have the Picture Boxes set a 231 px wide by 231 px high, and I want to resize these in a separate box when a user hovers...
5
8312
by: Henry Stock | last post by:
I am trying to understand the following error: Any thing you can tell me about this is appreciated. Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details: for the permission of type
0
8399
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8312
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8606
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6169
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2732
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.