Get homepage

Everything else that doesn't fall into one of the other PB categories.
Killswitch
Enthusiast
Enthusiast
Posts: 731
Joined: Wed Apr 21, 2004 7:12 pm

Get homepage

Post by Killswitch »

Hey,

How can you get the homepage (as set in IE and/or FireFox) of a users browser? Thanks a lot!
~I see one problem with your reasoning: the fact is thats not a chicken~
Beach
Enthusiast
Enthusiast
Posts: 677
Joined: Mon Feb 02, 2004 3:16 am
Location: Beyond the sun...

Post by Beach »

IE's start page is stored in the registry here:
"HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Start Page"

Not sure about FireFox...
-Beach
Beach
Enthusiast
Enthusiast
Posts: 677
Joined: Mon Feb 02, 2004 3:16 am
Location: Beyond the sun...

Post by Beach »

Looks like FireFox stores values in the users profile directory in a file called "prefs.js". I see an entry there called "browser.startup.homepage" that points to my startup page.

My profile directory is "C:\Documents and Settings\Beach\Application Data\Mozilla\Firefox\Profiles\default.coz\"... YMMV

-Beach
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

To get internet explorer's home page use something like this:

Code: Select all

;read a key from the registry
Procedure.s ReadRegKey(OpenKey.l, SubKey.s, ValueName.s)
    hKey.l = 0
    KeyValue.s = Space(255)
    Datasize.l = 255
    If RegOpenKeyEx_(OpenKey, SubKey, 0, #KEY_READ, @hKey)
        KeyValue = "Error Opening Key"
    Else 
        If RegQueryValueEx_(hKey, ValueName, 0, 0, @KeyValue, @Datasize)
            KeyValue = "Error Reading Key"
        Else  
            KeyValue = Left(KeyValue, Datasize - 1)
        EndIf
        RegCloseKey_(hKey)
    EndIf
    ProcedureReturn KeyValue
EndProcedure

Debug ReadRegKey(#HKEY_CURRENT_USER, "Software\Microsoft\Internet Explorer\Main", "Start Page")
Like Beach said Firefox doesn't seem to save anything into the registry but into your %appdata% folder instead. Look at the "prefs.js" file.
--Kale

Image
Post Reply