Программно найти окно скайпа - VB
Формулировка задачи:
Добрый день! Я не силен в таких вещах, помогите мне программно найти окно скайпа.
Решение задачи: «Программно найти окно скайпа»
textual
Листинг программы
Option Explicit ' Ïðèìåð ïðîãðГ*ììГ*îãî ïîäêëþ÷åГ*ГЁГї Skype ' © Êðèâîóñ ГЂГ*Г*òîëèé ГЂГ*Г*òîëüåâè÷ (The trick), 2014 Private Const IID_IDispatch As String = "{00020400-0000-0000-C000-000000000046}" Private Const IID_IHTMLElement As String = "{3050f1ff-98b5-11cf-bb82-00aa00bdce0b}" Private Const OBJID_CLIENT As Long = -4 Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExW" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As Long, ByVal lpsz2 As Long) As Long Private Declare Function AccessibleObjectFromWindow Lib "oleacc" (ByVal hwnd As Long, ByVal dwId As Long, ByRef riid As UUID, ByRef ppvObject As Object) As Long Private Declare Function IIDFromString Lib "ole32" (ByVal lpsz As Long, ByRef lpiid As UUID) As Long Private Declare Function GetMem4 Lib "msvbvm60" (Src As Any, Dst As Any) As Long Private Sub Form_Load() Dim ieWnd As Long ' ГЋГЄГ*Г* Г±ГЄГ*éïГ* Dim i As Long ' Ñ÷åò÷èê Dim IEObj As Object ' ГЋГЎГєГҐГЄГІ IHTMLElement Dim DispUUID As UUID ' UIID IDispatch Dim HTMLUUID As UUID ' UIID IHTMLElement Dim srv As olelib2.IServiceProvider ' Äëÿ äîñòóïГ* ГЄ IHTMLElement Dim Elem As Object ' Òåëî HTML äîêóìåГ*ГІГ* Dim logn As Object ' Ïîëå ââîäГ* ëîãèГ*Г* Dim pswd As Object ' Ïîëå ââîäГ* ГЇГ*ðîëÿ Dim btn As Object ' ГЉГ*îïêГ* âõîäГ* ' Г‡Г*ïîëГ*ГїГҐГ¬ UIID'Г» IIDFromString StrPtr(IID_IDispatch), DispUUID IIDFromString StrPtr(IID_IHTMLElement), HTMLUUID ' ГЌГ*õîäèì Г*ГіГ¦Г*îå Г*Г*Г¬ îêГ*Г® For i = 0 To 5 ieWnd = FindWindowEx(ieWnd, 0, StrPtr(Choose(i + 1, _ "TLoginForm", "TLoginControl", "TBrowserControl", _ "Shell Embedding", "Shell DocObject View", "Internet Explorer_Server")), 0) Next ' Ïîëó÷Г*ГҐГ¬ ññûëêó Г*Г* ГЁГ*òåðôåéñ IAccessible, äëÿ äîñòóïГ* ГЄ ýëåìåГ*ГІГ*Г¬ Г±ГІГ°Г*Г*èöû If AccessibleObjectFromWindow(ieWnd, OBJID_CLIENT, DispUUID, IEObj) Then MsgBox "error": Exit Sub End If ' Ïîëó÷Г*ГҐГ¬ òåëî äîêóìåГ*ГІГ* Set srv = IEObj.accChild(CVar(CLng(0))) ' Г‡Г*ГЇГ°Г*ГёГЁГўГ*ГҐГ¬ ГЁГ*òåðôåéñ IHTMLElement äëÿ äîñòóïГ* ГЄ ñâîéñòâГ*Г¬ ГІГҐГ«Г* <BODY> srv.QueryService HTMLUUID, DispUUID, i GetMem4 i, ByVal VarPtr(Elem) ' Ââîäèì ëîãèГ* Set logn = Elem.All("username") logn.Value = "The trick" ' Ââîäèì ГЇГ*ðîëü Set pswd = Elem.All("password") pswd.Value = "My password" ' ГЌГ*æèìГ*ГҐГ¬ ГЄГ*îïêó Set btn = Elem.All("buttonSignIn") btn.focus btn.Click ' ГЋГ·ГЁГ±ГІГЄГ* Set Elem = Nothing Set btn = Nothing Set pswd = Nothing Set logn = Nothing End Sub
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д