dneprcomp
Silver Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Код: Public TargetHwnd As Long Public Declare Function EnumWindows Lib "user32" _ (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _ (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long 'TargetName 'заголовок окна/ window caption(title) TargetHwnd = 0 Public Function CheckWindow (ByVal TargetName As String) as Boolean ' Используем EnumWindows для проверки существования окна ' Проверяем загруженные окна в памяти по заголовку окна EnumWindows AddressOf WindowEnumerator, 0 ' See if we got an hwnd. If TargetHwnd = 0 Then 'файл не загружен CheckWindow = False ElseIf TargetHwnd > 0 Then CheckWindow = True файл загружен End If End Function Public Function WindowEnumerator(ByVal app_hwnd As Long, ByVal lParam As Long) As Long ' Return False to stop the enumeration. Dim buf As String * 256 Dim Title As String Dim length As Long ' Get the window's title. length = GetWindowText(app_hwnd, buf, Len(buf)) Title = Left$(buf, length) ' See if the title contains the target. If InStr(Title, TargetName) > 0 Then ' Save the hwnd and end the enumeration. TargetHwnd = app_hwnd WindowEnumerator = False Else ' Continue the enumeration. WindowEnumerator = True End If End Function |
| Всего записей: 3920 | Зарегистр. 31-03-2002 | Отправлено: 23:11 29-07-2005 | Исправлено: dneprcomp, 01:26 09-08-2005 |
|