发一灰色按钮+菜单突破工具(含代码)
模块:
'-------------------------------------------------------
'''''''''''''''''''''''''''''winnip----------200807.
'-------------------------------------------------------
Public Declare Function IsWindowEnabled Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
Public Type POINTAPI
x As Long
Y As Long
End Type
Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Const HWND_TOPMOST = -1
Public Const MF_ENABLED = &H0&
Public Const MF_BYPOSITION = &H400&
Public Const MF_BYCOMMAND = &H0&
Public Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Public Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Public Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Public Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
Public cursorPos1 As POINTAPI
Public Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Public Declare Function EnableMenuItem Lib "user32" (ByVal hMenu As Long, ByVal wIDEnableItem As Long, ByVal wEnable As Long) As Long
Public Function WndEnumChildProc(ByVal hwnd1 As Long, ByVal lParam As Long) As Long
'bRet = GetClassName(hwnd, myStr, 50)
If IsWindowEnabled(hwnd1) = 0 Then EnableWindow hwnd1, 1
'if you want the text for only Edit class then use the if statement:
'If (Left(myStr, 4) = "Edit") Then
'You can sort the enumerated windows into the listview control but
'I would recommend not to do so bcuz its also worth learning the order
'in which windows does the enumeration.
'Debug.Print hwnd1
'End If
Form1.Text1.Text = hwnd1
WndEnumChildProc = 1
End Function
Public Sub TopMenu(ByVal hwnd As Long)
Dim n As Integer
hMenu = GetMenu(hwnd)
TopMenuCount = GetMenuItemCount(hMenu)
Debug.Print TopMenuCount
For n = 0 To TopMenuCount
EnableMenuItem hMenu, n, MF_ENABLED + MF_BYPOSITION + MF_BYCOMMAND
SubMenu hMenu, n
Next n
End Sub
Public Sub SubMenu(ByVal hMenu As Long, ByVal l As Integer)
Dim Y As Integer
hSubMenu = GetSubMenu(hMenu, l)
SubMenuCount = GetMenuItemCount(hSubMenu)
Debug.Print hSubMenu
For Y = 0 To SubMenuCount
EnableMenuItem hSubMenu, Y, MF_ENABLED + MF_BYPOSITION + MF_BYCOMMAND
Next Y
End Sub
窗体:
'-------------------------------------------------------
'''''''''''''''''''''''''''''winnip----------200807.
'-------------------------------------------------------
Dim hwnd1 As Long, r As Long, k As Long
Private Sub Timer1_Timer()
r = GetCursorPos(cursorPos1)
hwnd1 = WindowFromPoint(cursorPos1.x, cursorPos1.Y)
'EnableWindow hwnd1, 1
TopMenu hwnd1
hwnd1 = EnumChildWindows(hwnd1, AddressOf WndEnumChildProc, 0&)
End Sub
Private Sub Form_Load()
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, 1
icount = 0
End Sub
有些没用的,代码是东凑西凑的。不过经过我改了,加了一菜单。
菜鸟可以收留,高手飘过~
附件
-
灰色按钮突破.rar
(2.67 KB)
-
2008-7-27 19:43, 下载次数: 29