Private Declare Function GetWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Const GW_HWNDNEXT = 2:
Private Const GW_CHILD = 5
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_LBUTTONUP = &H202
Dim buff As String
Dim hwnds As Long 'õåГ*äåë îêГ*Г*
Dim kontrq As Long 'õåГ*äåë îêГ*Г*
Dim Knopka As Long 'õåГ*äåë îêГ*Г*
Dim Vxod As Long 'õåГ*äåë îêГ*Г*
Dim Vixod As Long 'õåГ*äåë îêГ*Г*
Private Function Hstr(HenTek) As String
Dim buffz$
buffz = Space$(50):
SendMessage HenTek, &HD, 40, ByVal buffz
buffz = Trim(buffz)
buffz = Left(buffz, Len(buffz) - 1)
Hstr = buffz
End Function
Private Sub SkanOkon()
Dim HenTek As Long ' ïîëó÷èì äåñêðèïòîð ñëåäóþùåãî îêГ*Г* Гў Z-order
HenTek = GetWindow(hwnds, GW_CHILD) 'ïîëó÷Г*ГҐГ¬ äåñêðèïòîð äî÷åðГ*ГҐГЈГ® îêГ*Г*
Do
If HenTek <> 0 Then ' Г*ГҐ èñïîëüçóéòå ГґГ«Г*æêè, åñëè Г*ГЁГЄГ*êîãî ГІГ*êîãî îêГ*Г* Г*ГҐ Г±ГіГ№ГҐГ±ГІГўГіГҐГІ
If Len(Hstr(HenTek)) <> 0 Then
buff = Hstr(HenTek)
If buff = "Îòêëþ÷èòü" Then
Knopka = HenTek
Exit Do
End If
If buff = "Ïîäêëþ÷èòü" Then
Knopka = HenTek
Exit Do
End If
buff = Right(buff, 4)
If buff = "kbps" Then
If Vxod = 0 Then
Vxod = HenTek
Else
Vixod = HenTek
End If
End If
End If
'ÏðîâåðêГ* Г*Г* äåòåé-------------------------------------------
kontrq = GetWindow(HenTek, GW_CHILD) 'ïîëó÷Г*ГҐГ¬ äåñêðèïòîð äî÷åðГ*ГҐГЈГ® îêГ*Г*
If kontrq <> 0 Then 'Åñëè Г*ГҐГІГі äèòÿ ïðîïóñêГ*ГҐГ¬ ýòîò ГёГ*ГЈ
hwnds = HenTek 'ïåðåäГ*ВёГ¬ õåГ*äåë Гў ðåêóðñèþ
Call SkanOkon
End If
End If
HenTek = GetWindow(HenTek, GW_HWNDNEXT) 'ïîëó÷Г*ГҐГ¬ äåñêðèïòîð ñëåäóþùåãî îêГ*Г*
Loop While HenTek <> 0
End Sub
Private Sub Command1_Click()
If Command1.Caption = "ГЏГіГ±ГЄ" Then
Timer2.Enabled = True
Command1.Caption = "Ñòîï"
Else
Timer2.Enabled = False
Command1.Caption = "ГЏГіГ±ГЄ"
End If
End Sub
Private Sub Form_Load()
hwnds = FindWindow(vbNullString, "ГЊГҐГЈГ*ÔîГ* Г€Г*ГІГҐГ°Г*ГҐГІ")
Call SkanOkon
Timer1.Interval = 200
Timer2.Interval = 10000
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Hstr(Vixod)
Label2.Caption = Hstr(Vxod)
Label3.Caption = Hstr(Knopka)
End Sub
Private Sub Timer2_Timer()
If Hstr(Knopka) = "Ïîäêëþ÷èòü" Then
SendMessage Knopka, WM_LBUTTONDOWN, 0, ByVal 327680
SendMessage Knopka, WM_LBUTTONUP, 0, ByVal 327680
End If
If Len(Hstr(Vixod)) <> 0 Then
buff = Left(Hstr(Vixod), 4)
If buff = "0.00" Then
SendMessage Knopka, WM_LBUTTONDOWN, 0, ByVal 327680
SendMessage Knopka, WM_LBUTTONUP, 0, ByVal 327680
End If
End If
End Sub