--------------------------------------------------------------------------------
黑客动画吧 http://www.hack58.com
致力于中国最专业的黑客安全站点
黑客动画吧,有你更精彩
--------------------------------------------------------------------------------
大家好,我是傻小子 VB打造灰色按钮克星
此小工具可以激活最上层操作窗口灰色(不可点击的按钮),可以用于安装时需要输入序列号的地方,功能自己去发现吧。
看我操作
咱们需要 3个 Command 一个 List
一个 Check
------------form代码 ----------------------
Dim window, child As Long
Private Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As _
String, ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Const str1 = "mndsoft.com "
Private Sub Check1_Click()
If Check1.value = 1 Then
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, 1
Else
SetWindowPos Me.hwnd, 0, 0, 0, 0, 0, 1
End If
End Sub
Private Sub Check1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If GetForegroundWindow = Me.hwnd Then Check1.SetFocus
End Sub
Private Sub Command1_Click()
Timer1.Enabled = True
Command1.Enabled = False
Command2.Enabled = True
End Sub
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If GetForegroundWindow = Me.hwnd Then Command1.SetFocus
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
Command1.Enabled = True
Command2.Enabled = False
End Sub
Private Sub Command2_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If GetForegroundWindow = Me.hwnd Then Command2.SetFocus
End Sub
Private Sub Command3_Click()
Timer1.Enabled = False
End
End Sub
Private Sub Command3_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If GetForegroundWindow = Me.hwnd Then Command3.SetFocus
End Sub
Private Sub Form_Load()
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, 1
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Label2.FontUnderline = False
End Sub
Private Sub Label3_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Label3.FontUnderline = True
End Sub
Private Sub Timer1_Timer()
Dim oldW As Long
Dim temp As String * 50
oldW = window
window = GetForegroundWindow
If oldW = window Then Exit Sub
If window = Me.hwnd Then Exit Sub
GetWindowText window, temp, 50
Me.Caption = "激活灰色按钮-----" & temp
icount = 1
List1.Clear
window = EnumChildWindows(window, AddressOf WndEnumChildProc, List1)
End Sub
Private Sub Timer2_Timer()
Static k
k = k + 1
If k > Len(str1) Then k = 1
Label2.Caption = Left(str1, k)
End Sub
模块代码:
Public Declare Function ChildWindowFromPoint Lib "user32" (ByVal hwnd As Long, ByVal xPoint As Long, ByVal yPoint As Long) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function GetActiveWindow Lib "user32" () As Long
Public Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Any) As Long
Public Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
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 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 Declare Function GetForegroundWindow Lib "user32" () As Long
Public Const HWND_TOPMOST = -1
Public icount As Integer
Function GetText(Ihwnd As Long) As String
Dim Textlen As Long
Dim Text As String
Textlen = SendMessage(Ihwnd, WM_GETTEXTLENGTH, 0, 0)
If Textlen = 0 Then
GetText = "(No text)"
Exit Function
End If
Textlen = Textlen + 1
Text = Space$(Textlen)
Textlen = SendMessage(Ihwnd, WM_GETTEXT, Textlen, ByVal Text)
GetText = Left$(Text, Textlen)
End Function
Public Function WndEnumChildProc(ByVal hwnd As Long, ByVal lParam As ListBox) As Long
Dim bRet As Long
Dim myStr As String * 50
bRet = GetClassName(hwnd, myStr, 50)
If IsWindowEnabled(hwnd) = 0 Then EnableWindow hwnd, 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.
lParam.AddItem Str(hwnd) & "--" & Left(myStr, 20) & "--" & GetText(hwnd)
icount = icount + 1
'End If
WndEnumChildProc = 1
End Function
黑吧傻小子! 大家8888888888888