Web Development

General discussion


VB Code

By tech_fyi ·
1. I want VB source code to disable/enable popup blocker from the registry that allows all the popups.
2. I also need VB code to configure LAN automatically in win98/win2000/winxp and all other OS in registry

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by J*R;) In reply to VB Code

Is this what you're looking for:
Part 1:

Option Explicit

HKEY_DYN_DATA = &H80000006
HKEY_USERS = &H80000003
End Enum

Private Declare Function RegCreateKey Lib _
"advapi32.dll" Alias "RegCreateKeyA" _
(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 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 Const REG_SZ = 1

Public Function SetIEPopUpBlock(ByVal flPop As Boolean) As Boolean
'*PURPOSE: Sets the Pop Up Blocker for Internet Explorer
'* Example: SetIEPopUpBlock True
if flPop then

SetIEPopUpBlock = WriteStringToRegistry(HKEY_CURRENT_USER, _
"Software\Microsoft\Internet Explorer\New Windows", _
"PopupMgr", "yes")


SetIEPopUpBlock = WriteStringToRegistry(HKEY_CURRENT_USER, _
"Software\Microsoft\Internet Explorer\New Windows", _
"PopupMgr", "no")

end if

End Function

Collapse -

by J*R;) In reply to VB Code

Part 2:

Private Function WriteStringToRegistry(Hkey As _
REG_TOPLEVEL_KEYS, strPath As String, strValue As String, _
strdata As String) As Boolean

'Author: Waty Thierry

Dim bAns As Boolean

On Error GoTo ErrorHandler
Dim keyhand As Long
Dim r As Long
r = RegCreateKey(Hkey, strPath, keyhand)
If r = 0 Then
r = RegSetValueEx(keyhand, strValue, 0, _
REG_SZ, ByVal strdata, Len(strdata))
r = RegCloseKey(keyhand)
End If

WriteStringToRegistry = (r = 0)

Exit Function

WriteStringToRegistry = False
Exit Function

End Function

Related Discussions

Related Forums