1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
Option Explicit
Declare Function GetSystemMetrics32 Lib "user32" Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetWindow& Lib "user32" (ByVal hWnd&, ByVal wCmd&)
Private Declare Function GetWindowLong& Lib "user32" _
Alias "GetWindowLongA" (ByVal hWnd&, ByVal nIndex&)
Private Declare Function GetWindowText& Lib "user32" Alias _
"GetWindowTextA" (ByVal hWnd&, ByVal lpString$, ByVal aint&)
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
Private Const mconMAXLEN = 255
Sub AxelActivate()
Dim hWnd&, Style&, Title$, i&
Dim appStatus As String
appStatus = ""
hWnd = GetWindow(GetDesktopWindow(), 5)
Do While hWnd
Title = GetCaption(hWnd)
If Len(Title) Then
If GetWindowLong(hWnd, -16) And &H10000000 Then
If InStr(1, Title, "Axel", 1) Then
AppActivate Title
SendKeys "~"
appStatus = "Ready"
Exit Do
End If
End If
End If
hWnd = GetWindow(hWnd, 2)
Loop |
Partager