MJBNET
Nov 20th, 2001, 08:19 AM
I am trying to edit the key to turn off images in IE, from a macro in Excel...It has no effect, no errors, no new entrys, nothin. I am sure it is the right key 'cause I see it change when I turn it off from IE advanced options... I copied most of the code right out of the API guide on this site... plz help :}
This is the code
****************************************************
'declarations
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
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
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
____________________________________________________
Sub AA()
Dim subkey As String
Dim stringbuffer As String
Dim hregkey As Long
subkey = "Software\Microsoft\Internet Explorer\Main\Display Inline Images"
stringbuffer = "no" & vbNullChar
RegOpenKeyEx HKEY_CURRENT_USER, subkey, 0, KEY_WRITE, hregkey
RegSetValueEx hregkey, "subkey", 0, REG_SZ, ByVal stringbuffer, Len(stringbuffer)
RegCloseKey hregkey
End Sub
This is the code
****************************************************
'declarations
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
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
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
____________________________________________________
Sub AA()
Dim subkey As String
Dim stringbuffer As String
Dim hregkey As Long
subkey = "Software\Microsoft\Internet Explorer\Main\Display Inline Images"
stringbuffer = "no" & vbNullChar
RegOpenKeyEx HKEY_CURRENT_USER, subkey, 0, KEY_WRITE, hregkey
RegSetValueEx hregkey, "subkey", 0, REG_SZ, ByVal stringbuffer, Len(stringbuffer)
RegCloseKey hregkey
End Sub