- 超级版主
- 1228894
- 26968
- 25
- 8043 朵
- 36122 个
- 4739 个
- 421340
- 2012-07-18
|
1#
t
T
发表于 2021-11-16 00:03
|
|只看楼主
原 [2020.09.19更新]命令库分享----PC按键----句柄遍历代码生成[第一章●附录]源码分享 2021.11.11新建QQ交流群:891058946后续更新在本群发布 解压密码:N7 示范:源码:- DimEnv 子窗口句柄
- Declare Function GetParent Lib "user32" Alias "GetParent" (ByVal hwnd As Long) As Long
- Public Declare Function SetSystemCursor Lib "user32" Alias "SetSystemCursor" (ByVal hcur As Long, ByVal id As Long) As Long
- Public Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
- Public Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long)
- Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
- Event Form1.Timer1.Timer
- LButton = GetAsyncKeyState(1)
- If LButton = 0 Then
- hwnd = Plugin.Window.MousePoint()
- sRect1 = Plugin.Window.GetClientRect(Hwnd)
- xy = Split(sRect1, "|")
- GetCursorPos x1, y1
- Form1.InputBox3.Text=x1 - xy(0)&","&y1 - xy(1)
- Form1.InputBox1.Text = hwnd
- Form1.PictureBox1.Picture = "Attachment:\光标2.jpg"
- SystemParametersInfo 87, 0, 0, 2
- Form1.Timer1.Enabled = False
- 子窗口句柄=Hwnd
- BeginThread 生成代码
- Else
- hwnd = Plugin.Window.MousePoint()
- Call Plugin.WndEx6.HighlightWindow(hwnd, 4, "0000FF", 200)
- End If
- End Event
- Event Form1.PictureBox1.Click
- hCursor = LoadCursorFromFile("c:\变化.cur")
- Call SetSystemCursor(hCursor, 32512)
- Form1.Timer1.Enabled = True
- Form1.PictureBox1.Picture = "Attachment:\光标1.jpg"
- Form1.InputBox2.Text = ""
- End Event
- Event Form1.Load
- PutAttachment "c:\","变化.cur"
- End Event
- Sub 生成代码()
- Call Plugin.File.DeleteFile("C:\七罪.txt")
- 原始窗口=子窗口句柄
- Do
- 上一级窗口句柄=GetParent(子窗口句柄)
- If 上一级窗口句柄 = 0 Then
- 得到顶层窗口句柄 = 子窗口句柄
- Exit Do
- Else
- 结果= 上一级窗口句柄&","&结果
- 子窗口句柄=上一级窗口句柄
- End If
- Loop
- Do
- If 结果 = "" Then
- TracePrint "本句柄为父句柄 or 检查句柄_句柄错误!"
- 类名 = Plugin.Window.GetClass(子窗口句柄)
- 标题 = Plugin.Window.GetText(子窗口句柄)
- Text= "Hwnd = Plugin.Window.Find(" & chr(34) & 类名 & chr(34) & ", " & chr(34) & 标题 & chr(34) & ")"
- Call Plugin.Sys.SetCLB(Text)
- Form1.InputBox2.Text = Text
- Call Plugin.Sys.SetCLB(Text)
- TracePrint "写入剪切板完成. ..."&vbcrlf&"作者QQ:1223116618;交流群:891058946"
- ExitScript
- End If
- 分割 = Split(结果, ",")
- 类名 = Plugin.Window.GetClass(分割(0))
- 标题 = Plugin.Window.GetText(分割(0))
- Hwnd = Plugin.Window.Find(类名, 标题)
- Call Plugin.File.WriteFileEx("C:\七罪.txt","Hwnd = Plugin.Window.Find("&chr(34) & 类名 &chr(34)& ", " &chr(34) & 标题&chr(34) & ")")
- 分割(UBound(分割))=原始窗口
- For i = 1 To UBound(分割)
- 类名 = Plugin.Window.GetClass(分割(i))
- Call Plugin.File.WriteFileEx("C:\七罪.txt", " Hwnd1=0")
- Hwnd1 = 0
- Do
- Hwnd1 = Plugin.Window.FindEx(Hwnd, Hwnd1, 类名, 0)
- If Hwnd1 = 0 Then
- Exit for
- End If
- Call Plugin.File.WriteFileEx("C:\七罪.txt","Hwnd1 = Plugin.Window.FindEx(Hwnd, Hwnd1, "&chr(34)&类名&chr(34)&", 0)")
- Delay 5
- Loop Until Hwnd1 = int(分割(i))
- Call Plugin.File.WriteFileEx("C:\七罪.txt","Hwnd = Hwnd1")
- Hwnd = Hwnd1
- Next
- If Hwnd1 / 1 = 原始窗口 / 1 Then
- Exit Do
- Else
- 结果 = mid(结果, instr(结果, ",") + 1, len(结果) - instr(结果, ","))
- End If
- Loop
- Call Plugin.File.WriteFileEx("C:\七罪.txt", "TracePrint Hwnd1")
- Call Plugin.File.WriteFileEx("C:\七罪.txt","TracePrint "&chr(34)&"写入剪切板完成. ...作者QQ:1223116618;交流群:677099204"&chr(34))
- Text = Replace(Plugin.File.ReadFileEx("C:\七罪.txt"), "|", vbcrlf)
- Form1.InputBox2.Text = Text
- Call Plugin.Sys.SetCLB(Text)
- End Sub
- Event Form1.Button1.Click
- Call Plugin.Sys.SetCLB( Form1.InputBox3.Text )
- End Event
复制代码 源文件: - x.rar (, 下载次数:632)
点评
果壳王子
桌面壁纸才是焦点
发表于 2021/11/16 0:30:44
|