Yogesh_Agarwal
asked on
Small Error -> vb6 Code to VB.net
Here i am getting error. "As Any" cannot be used in Declare statements. Please clear all errors in this code..
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
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey 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
Const KEY_WRITE = &H20006
Const REG_SZ = 1
Const KEY_HKCU = &H80000001 'long value for HKEY_CURRENT_USER
Sub SetRegistryValue(value As String)
Dim handle As Long
Dim strValue As String
Dim retVal As Long
' Open the key, exit if not found
If RegOpenKeyEx(KEY_HKCU, "Software\Microsoft\Internet Explorer\Main", 0, KEY_WRITE, handle) Then
Exit Sub
End If
strValue = value
retVal = RegSetValueEx(handle, "Display Inline Images", 0, REG_SZ, ByVal strValue, Len(strValue))
' Close the key and signal success
RegCloseKey handle
End Sub
Public Function ShowImages()
SetRegistryValue ("yes")
End Function
Public Function HideImages()
SetRegistryValue ("no")
End Function
ASKER
but this code helps me to switch off loading of images in webbrowser control (IE) as i don know how to do it programatically. I want to change registry(switch of loading of image in IE programatically).. cud u please help me?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
change it for a String in this case.
Right...if you want to keep the old API approach then change all Long to Integer, and replace As Any with the appropriate Type.
ASKER
great..
Check this examples:
http://www.codeproject.com
http://www.devasp.net/net/
http://www.wwwcoder.com/ma