Results 1 to 12 of 12

Thread: finding homepage[resolved]

  1. #1

    Thread Starter
    Fanatic Member vbasicgirl's Avatar
    Join Date
    Jan 2004
    Location
    Manchester, UK
    Posts
    1,016

    finding homepage[resolved]

    is there any code or even an api that can tell me the users homepage ?
    i dont want to know how to change it.

    thank you.
    casey.
    Last edited by vbasicgirl; Aug 30th, 2004 at 05:13 PM.

  2. #2
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    Well, theres only one way I know, and its a bit obvious.
    Use the Registry APIs to find this:
    "HKEY_USERS\(numbers here)\Software\Microsoft\Internet Explorer\Main" and the Start Page value.. (XP Pro)..

    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  3. #3

    Thread Starter
    Fanatic Member vbasicgirl's Avatar
    Join Date
    Jan 2004
    Location
    Manchester, UK
    Posts
    1,016
    thanks Phreak but i havnt a clue when it comes to the registry, could you possibly give me an example as i wouldnt like to mess anything up.

    thank you.
    casey.

  4. #4
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    Only one I could find on short notice...its useable though..

    Phreak
    Attached Files Attached Files

    Visual Studio 6, Visual Studio.NET 2005, MASM

  5. #5

    Thread Starter
    Fanatic Member vbasicgirl's Avatar
    Join Date
    Jan 2004
    Location
    Manchester, UK
    Posts
    1,016
    thanks for your time Phreak but its over my head.
    wouldnt know where to start.

    thanks
    casey.

  6. #6
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    Just chuck that module into your project and use this:
    VB Code:
    1. MsgBox regQuery_A_Key(HKEY_USERS, "S-1-5-21-682003330-839522115-1060284298-500\Software\Microsoft\Internet Explorer\Main", "Start Page")
    (numbers may be different, I'm not sure..)

    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  7. #7

    Thread Starter
    Fanatic Member vbasicgirl's Avatar
    Join Date
    Jan 2004
    Location
    Manchester, UK
    Posts
    1,016
    i tried that but i get an empty message box, i have no idea what to change.
    thanks for your help anyway, ill see if theres another way.

    thank you.
    casey.

  8. #8
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    It still does depend on what browser the user is using... I never use IE and that solution only works for that particular piece of cr.. I mean, software...
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  9. #9
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    Try this:

    VB Code:
    1. Option Explicit
    2.  
    3. Private Const MAX_PATH As Long = 260
    4. Private Const ERROR_SUCCESS As Long = 0&
    5. Private Const INVALID_HANDLE_VALUE = -1
    6. Private Const HKEY_CURRENT_USER As Long = &H80000001
    7. Private Const REG_SZ As Long = 1
    8. Private Const READ_CONTROL As Long = &H20000
    9. Private Const KEY_QUERY_VALUE As Long = &H1
    10. Private Const KEY_SET_VALUE = &H2
    11. Private Const KEY_CREATE_SUB_KEY = &H4
    12. Private Const KEY_ALL_ACCESS As Long = &HF003F
    13. Private Const KEY_ENUMERATE_SUB_KEYS As Long = &H8
    14. Private Const KEY_NOTIFY As Long = &H10
    15. Private Const SYNCHRONIZE As Long = &H100000
    16. Private Const STANDARD_RIGHTS_WRITE As Long = READ_CONTROL
    17.  
    18. Private Const KEY_READ As Long = ((READ_CONTROL Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And (Not SYNCHRONIZE))
    19. Private Const KEY_WRITE As Long = ((STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY) And (Not SYNCHRONIZE))
    20.                                      
    21. Private Const KEY_EXECUTE As Long = (KEY_READ And (Not SYNCHRONIZE))
    22.  
    23. 'Registry Key containing the Main Explorer Settings:
    24. Private Const sRegExplorerMain = "Software\Microsoft\Internet Explorer\Main"
    25.  
    26. Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
    27. Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, ByVal lpType As Long, ByVal lpData As Any, lpcbData As Long) As Long
    28. Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpszValueName As String, ByVal dwReserved As Long, ByVal dwType As Long, lpData As Any, ByVal nSize As Long) As Long
    29. Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
    30. Private Declare Function lstrlenW Lib "kernel32" (ByVal lpString As Long) As Long
    31.  
    32. Private Function RegGetStartPage() As String
    33.  Dim hKey As Long
    34.  Dim sizeData As Long
    35.  Dim tmpdata As String
    36.  
    37.  If RegOpenKeyEx(HKEY_CURRENT_USER, sRegExplorerMain, 0, KEY_READ, hKey) = ERROR_SUCCESS Then
    38.   tmpdata = Space$(MAX_PATH)
    39.   sizeData = Len(tmpdata)
    40.   RegQueryValueEx hKey, "Start Page", 0, 0, tmpdata, sizeData
    41.  
    42.   'Strip Nulls:
    43.   RegGetStartPage = TrimNull(tmpdata)
    44.  End If
    45.  
    46.  RegCloseKey hKey
    47. End Function
    48.  
    49. Private Function TrimNull(startstr As String) As String
    50.  TrimNull = Left$(startstr, lstrlenW(StrPtr(startstr)))
    51. End Function
    52.  
    53. Private Sub Form_Load()
    54.  Debug.Print RegGetStartPage
    55. End Sub
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  10. #10
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    P.D. I tried this code on Windows 2000 and Windows XP. I can't tell if it will work on Windows 95 and 98 (I doubt it)
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  11. #11
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    Please tell me if it was helpful to you. Here is the code for Netscape (I haven't tried it though):

    VB Code:
    1. Option Explicit
    2.  
    3. Private Const MAX_PATH As Long = 260
    4. Private Const ERROR_SUCCESS As Long = 0&
    5. Private Const INVALID_HANDLE_VALUE = -1
    6. Private Const HKEY_CURRENT_USER As Long = &H80000001
    7. Private Const REG_SZ As Long = 1
    8. Private Const READ_CONTROL As Long = &H20000
    9. Private Const KEY_QUERY_VALUE As Long = &H1
    10. Private Const KEY_SET_VALUE = &H2
    11. Private Const KEY_CREATE_SUB_KEY = &H4
    12. Private Const KEY_ALL_ACCESS As Long = &HF003F
    13. Private Const KEY_ENUMERATE_SUB_KEYS As Long = &H8
    14. Private Const KEY_NOTIFY As Long = &H10
    15. Private Const SYNCHRONIZE As Long = &H100000
    16. Private Const STANDARD_RIGHTS_WRITE As Long = READ_CONTROL
    17.  
    18. Private Const KEY_READ As Long = ((READ_CONTROL Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And (Not SYNCHRONIZE))
    19. Private Const KEY_WRITE As Long = ((STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY) And (Not SYNCHRONIZE))
    20.                                      
    21. Private Const KEY_EXECUTE As Long = (KEY_READ And (Not SYNCHRONIZE))
    22.  
    23. 'Registry Key containing the Main Explorer Settings:
    24. Private Const sRegExplorerMain = "Software\Microsoft\Internet Explorer\Main"
    25. Private Const sRegNetscapeMain = "Software\Netscape\Netscape Navigator\Main"
    26.  
    27. Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
    28. Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, ByVal lpType As Long, ByVal lpData As Any, lpcbData As Long) As Long
    29. Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpszValueName As String, ByVal dwReserved As Long, ByVal dwType As Long, lpData As Any, ByVal nSize As Long) As Long
    30. Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
    31. Private Declare Function lstrlenW Lib "kernel32" (ByVal lpString As Long) As Long
    32.  
    33. Private Function RegGetStartPageIE() As String
    34.  Dim hKey As Long
    35.  Dim sizeData As Long
    36.  Dim tmpdata As String
    37.  
    38.  If RegOpenKeyEx(HKEY_CURRENT_USER, sRegExplorerMain, 0, KEY_READ, hKey) = ERROR_SUCCESS Then
    39.   tmpdata = Space$(MAX_PATH)
    40.   sizeData = Len(tmpdata)
    41.   RegQueryValueEx hKey, "Start Page", 0, 0, tmpdata, sizeData
    42.  
    43.   'Strip Nulls:
    44.   RegGetStartPageIE = TrimNull(tmpdata)
    45.  End If
    46.  
    47.  RegCloseKey hKey
    48. End Function
    49.  
    50. Private Function RegGetStartPageN() As String
    51.  Dim hKey As Long
    52.  Dim sizeData As Long
    53.  Dim tmpdata As String
    54.  
    55.  If RegOpenKeyEx(HKEY_CURRENT_USER, sRegNetscapeMain, 0, KEY_READ, hKey) = ERROR_SUCCESS Then
    56.   tmpdata = Space$(MAX_PATH)
    57.   sizeData = Len(tmpdata)
    58.   RegQueryValueEx hKey, "Home Page", 0, 0, tmpdata, sizeData
    59.  
    60.   'Strip Nulls:
    61.   RegGetStartPageN = TrimNull(tmpdata)
    62.  End If
    63.  
    64.  RegCloseKey hKey
    65. End Function
    66.  
    67. Private Function TrimNull(startstr As String) As String
    68.  TrimNull = Left$(startstr, lstrlenW(StrPtr(startstr)))
    69. End Function
    70.  
    71. Private Sub Form_Load()
    72.  Debug.Print "Internet Explorer: " & RegGetStartPageIE
    73.  Debug.Print "Netscape: " & RegGetStartPageN
    74. End Sub

    P.S. Remember to add "Resolved" to your thread if your problem was solved.
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  12. #12

    Thread Starter
    Fanatic Member vbasicgirl's Avatar
    Join Date
    Jan 2004
    Location
    Manchester, UK
    Posts
    1,016
    thanks for the code Tec-Nico.

    casey.

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