获取桌面图标名称,坐标,并移动。哪位大哥给个思路。
图标名称是不是很难获取的,坐标跟移动基本能实现。就是不能指定图标,桌面就乱了。图标号不精准。
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long) Private Const MOUSEEVENTF_MOVE = &H1 '移动鼠标 Private Const MOUSEEVENTF_LEFTDOWN = &H2 '模拟鼠标左键按下 Private Const MOUSEEVENTF_LEFTUP = &H4 '模拟鼠标左键抬起 Private Const MOUSEEVENTF_ABSOLUTE = &H8000 '标示是否采用绝对坐标 Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Sub Form_Load() Form1.Visible = False SetCursorPos 259, 231 '鼠标移动到图标源位置 mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 '左键按下 Sleep 1000 '实测操作必须停顿,停顿时间必须>=24 SetCursorPos 972, 315 '鼠标移动到目标位置 mouse_event MOUSEEVENTF_ABSOLUTE + MOUSEEVENTF_MOVE, 0, 0, 0, 0 Sleep 1000 '实测操作必须停顿,停顿时间必须>=24 mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 End Sub