CodeItBetter Programming Another VB Programming Blog

How to Change Internet Explorer Start Page and Main Window Title

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'Internet - How to Change Internet Explorer Start Page and Main Window Title

Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal HKey As Long, _
    ByVal lpSubKey As String, phkResult As Long) As Long
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal HKey As Long) As Long
Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal HKey As Long, _
    ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, _
    ByVal cbData As Long) As Long
Public Const REG_SZ = 1
Public Const HKEY_CURRENT_USER = &H80000001
 
Public Sub SaveString(HKey As Long, Path As String, Name As String, Data As String)
    Dim KeyHandle As Long
    Call RegCreateKey(HKey, Path, KeyHandle)
    Call RegSetValueEx(KeyHandle, Name, 0, REG_SZ, ByVal Data, Len(Data))
    Call RegCloseKey(KeyHandle)
End Sub
 
Public Sub SetStartPage(URL As String)
    Call SaveString(HKEY_CURRENT_USER, "Software\Microsoft\Internet Explorer\Main", "Start Page", URL)
End Sub
 
Public Sub SetWindowTitle(Title As String)
    Call SaveString(HKEY_CURRENT_USER, "Software\Microsoft\Internet Explorer\Main", "Window Title", Title)
End Sub
 
Private Sub Form_Load()
    SetStartPage ("http://www.codeitbetter.com/")
    SetWindowTitle ("Test Title!")
End Sub
Filed under: Internet Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.