Bonjour, DVP met à votre disposition une nouvelle application de téléchargement,
vous y retrouverez une des contributions de Ridan à la page sources VB : Modifier la page de démarrage IE



Comment modifier par le code la page de démarrage d'Internet Explorer

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
 
Private Const HKEY_CLASSES_ROOT = &H80000000
Private Const HKEY_CURRENT_USER = &H80000001
Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Const HKEY_USERS = &H80000003
Private Const HKEY_PERFORMANCE_DATA = &H80000004
 
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" _
        (ByVal Hkey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal Hkey As Long) As Long
Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" _
        (ByVal Hkey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, _
        lpType As Long, lpData As Any, lpcbData As Long) As Long
Private 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
 
Private Sub Command1_Click()
 
    Dim result As Long, temp As Long
    Dim contenu As String
 
    contenu = Text1.Text
 
    temp = RegOpenKey(HKEY_CURRENT_USER, "Software\Microsoft\Internet Explorer\Main", result)
    temp = RegSetValueEx(result, "Start Page", 0, 1, ByVal contenu, Len(contenu))
    temp = RegCloseKey(result)
 
End Sub
 
Private Sub Command2_Click()
 
    Dim result As Long, temp As Long
    Dim contenu As String
 
    contenu = "About:Blank"
 
    temp = RegOpenKey(HKEY_CURRENT_USER, "Software\Microsoft\Internet Explorer\Main", result)
    temp = RegSetValueEx(result, "Start Page", 0, 1, ByVal contenu, Len(contenu))
    temp = RegCloseKey(result)
 
End Sub
 
Private Sub Command3_Click()
 
    Dim result As Long, temp As Long, TailleTampon As Long
    Dim tampon As String
 
    temp = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Internet Explorer\Main", result)
    temp = RegQueryValueEx(result, "Default_Page_URL", 0, 0, ByVal 0, TailleTampon)
    tampon = String(TailleTampon, " ")
    temp = RegQueryValueEx(result, "Default_Page_URL", 0, 0, ByVal tampon, TailleTampon)
    temp = RegCloseKey(result)
 
    temp = RegOpenKey(HKEY_CURRENT_USER, "Software\Microsoft\Internet Explorer\Main", result)
    temp = RegSetValueEx(result, "Start Page", 0, 1, ByVal tampon, Len(tampon))
    temp = RegCloseKey(result)
 
End Sub
 
Private Sub Form_Load()
 
    Dim result As Long, temp As Long, TailleTampon As Long
    Dim tampon As String
 
    temp = RegOpenKey(HKEY_CURRENT_USER, "SOFTWARE\Microsoft\Internet Explorer\Main", result)
    temp = RegQueryValueEx(result, "Start Page", 0, 0, ByVal 0, TailleTampon)
    tampon = String(TailleTampon, " ")
    temp = RegQueryValueEx(result, "Start Page", 0, 0, ByVal tampon, TailleTampon)
    temp = RegCloseKey(result)
 
    Label2 = "Page de démarrage actuelle : " & tampon
 
End Sub
Qu'en pensez-vous ?





Retrouvez toutes les contributions à Ridan