Results 1 to 2 of 2

Thread: [2005] Get Registry Value

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2006
    Location
    In my head
    Posts
    913

    [2005] Get Registry Value

    I am trying to setup a small function to get the version of the default internet browser. Here is my code:

    VB Code:
    1. Imports Microsoft.Win32
    2. Imports System.Environment
    3.  
    4. Private Sub GetDefBrowser()
    5.  
    6.  Dim DefBrowser As String
    7.  Dim IEVersion As String
    8.        
    9. DefBrowser = Registry.ClassesRoot.GetValue("HKEY_CLASSES_ROOT\HTTP\shell\open\command").ToString
    10.        
    11. IEVersion = System.Diagnostics.FileVersionInfo.GetVersionInfo(DefBrowser).ProductVersion.ToString()
    12.  
    13. Label1.text = IEVersion
    14.  
    15. end sub

    I keep getting this error on the GetValue statement:
    {"Object reference not set to an instance of an object."}

    I have verified what is there in the registry:
    (Default) REG_SZ "C:\Program Files\Internet Explorer\IEXPLORE.EXE" -nohome

    What am i doing incorrectly or missing??

    Thank you in advance,

    Dminder

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2005] Get Registry Value

    VB Code:
    1. DefBrowser = Registry.ClassesRoot.OpenSubKey("\HTTP\shell\open\command", False).GetValue("").ToString

    that will get you the reg string, however you still need to parse it to remove any command line params that may be attached, like the -nohome part...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width