Jump to content
Nytro

[VB6] Disable Regedit ( new way )

Recommended Posts

Option Explicit
'---------------------------------------------------------------------------------------
' Module : mKillRegedit
' Author : Karcrack
' Now$ : 07/09/09 17:25
' Used for? : Disable Regedit
' TestedOn : Windows XP SP3
'---------------------------------------------------------------------------------------

'USER32
Private Declare Function CreateWindowEx Lib "USER32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, ByRef lpParam As Any) As Long
Private Declare Function RegisterClass Lib "USER32" Alias "RegisterClassA" (ByRef Class As WNDCLASS) As Long
Private Declare Function DefWindowProc Lib "USER32" Alias "DefWindowProcA" (ByVal Hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Private Type WNDCLASS
style As Long
lpfnwndproc As Long
cbClsextra As Long
cbWndExtra2 As Long
hInstance As Long
hIcon As Long
hCursor As Long
hbrBackground As Long
lpszMenuName As String
lpszClassName As String
End Type

Public Sub DisableRegedit()
Dim tWC As WNDCLASS

With tWC
.style = &H6008
.hInstance = App.hInstance
.lpfnwndproc = GetPtr(AddressOf WndProc)
.lpszMenuName = "#103"
.lpszClassName = "RegEdit_RegEdit"
End With

If RegisterClass(tWC) Then
Call CreateWindowEx(&H40000, "RegEdit_RegEdit", vbNullString, ByVal 0&, 0, 0, 0, 0, 0, 0, App.hInstance, ByVal 0&)
End If
End Sub

Private Function WndProc(ByVal Hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
WndProc = DefWindowProc(Hwnd, uMsg, wParam, lParam)
End Function

Private Function GetPtr(ByVal lPtr As Long) As Long
GetPtr = lPtr
End Function

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...