Модераторы: Akina
  

Поиск:

Ответ в темуСоздание новой темы Создание опроса
> Координаты открытых окон, Как взять координаты окон открытых прог 
:(
    Опции темы
capr
Дата 2.11.2005, 18:43 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 8
Регистрация: 19.10.2005

Репутация: нет
Всего: нет



Всем привет! Скажите, есть ли функция которая возвращает координаты и размеры (а может и имена) открытых окон различных программ на экране. Thanks
PM MAIL   Вверх
Naghual
Дата 2.11.2005, 18:50 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Эксперт
***


Профиль
Группа: Завсегдатай
Сообщений: 1893
Регистрация: 15.5.2004
Где: Украина, Днепр

Репутация: 26
Всего: 49



Код

' The GetWindowRect function retrieves the dimensions 
' of the bounding rectangle of the specified window. 
' The dimensions are given in screen coordinates that are 
' relative to the upper-left corner of the screen.

Declare Function GetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hwnd As Long, lpRect As RECT) As Long



--------------------
Я желаю всем Счастья!
PM ICQ Skype   Вверх
capr
Дата 2.11.2005, 19:27 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 8
Регистрация: 19.10.2005

Репутация: нет
Всего: нет



Спасибо. Но это для "указанного окна", а hwnd меняется? Что-то не пойму.
PM MAIL   Вверх
Naghual
Дата 3.11.2005, 12:09 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Эксперт
***


Профиль
Группа: Завсегдатай
Сообщений: 1893
Регистрация: 15.5.2004
Где: Украина, Днепр

Репутация: 26
Всего: 49



Код

' The FindWindow function retrieves the handle to the top-level window whose class name and
' window name match the specified strings. 
' This function does not search child windows.

Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
    (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

' · lpClassName
' Points to a null-terminated string that specifies the class name or is an atom that identifies 
' the class-name string. If this parameter is an atom, it must be a global atom created 
' by a previous call to the GlobalAddAtom function. The atom, a 16-bit value, must be placed 
' in the low-order word of lpClassName; the high-order word must be zero.

' · lpWindowName
' Points to a null-terminated string that specifies the window name (the window’s title).
' If this parameter is NULL, all window names match.





' The FindWindowEx function retrieves the handle to a window whose class name and 
' window name match the specified strings. 
' The function searches child windows, beginning with the one following the given child window.

Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
    (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

' · hwndParent
' Identifies the parent window whose child windows are to be searched.
' If hwndParent is NULL, the function uses the desktop window as the parent window.
' The function searches among windows that are child windows of the desktop.

' · hwndChildAfter
' Identifies a child window. The search begins with the next child window in the Z order.
' hwndChildAfter must be a direct child window of hwndParent, not just a descendant window.
' If hwndChildAfter is NULL, the search begins with the first child window of hwndParent.
' Note that if both hwndParent and hwndChildAfter are NULL, the function searches all top-level windows.

' · lpszClass
' Points to a null-terminated string that specifies the class name or is an atom that identifies 
' the class-name string. If this parameter is an atom, it must be a global atom created 
' by a previous call to the GlobalAddAtom function. The atom, a 16-bit value, must be 
' placed in the low-order word of lpszClass; the high-order word must be zero.

' · lpszWindow
' Points to a null-terminated string that specifies the window name (the window’s title). 
' If this parameter is NULL, all window names match.




--------------------
Я желаю всем Счастья!
PM ICQ Skype   Вверх
Guest
Дата 3.11.2005, 21:15 (ссылка)    |    (голосов: 0) Загрузка ... Загрузка ... Быстрая цитата Цитата


Unregistered











Спасибо. то, что надо.
  Вверх
BorisVorontsov
Дата 3.11.2005, 22:07 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Thinker
**


Профиль
Группа: Комодератор
Сообщений: 714
Регистрация: 3.11.2005
Где: Молдавия, г. Киши нёв

Репутация: 5
Всего: 10



Цитата(capr @ 2.11.2005, 18:43)
(а может и имена) открытых окон различных программ на экране


GetWindowText для заголовка и GetClassName для имени класса.


--------------------
[code=cpp]
const char *out = "|*0>78-,+<|"; size_t cc = char_traits<char>::length(out);
for (size_t i=0;i<cc;i++){cout<<static_cast<char>((out[i]^89));}cout<<endl;
[/code]
PM MAIL ICQ GTalk   Вверх
capr
Дата 4.11.2005, 18:43 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 8
Регистрация: 19.10.2005

Репутация: нет
Всего: нет



Спасибо, только у меня староватый MSDN, там нет ни FindWindowEx, ни GetWindowName, GetClassName - Можно по-подробней про эти функции или ссылку какую-нибудь.
PM MAIL   Вверх
BorisVorontsov
Дата 18.11.2005, 22:52 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Thinker
**


Профиль
Группа: Комодератор
Сообщений: 714
Регистрация: 3.11.2005
Где: Молдавия, г. Киши нёв

Репутация: 5
Всего: 10





--------------------
[code=cpp]
const char *out = "|*0>78-,+<|"; size_t cc = char_traits<char>::length(out);
for (size_t i=0;i<cc;i++){cout<<static_cast<char>((out[i]^89));}cout<<endl;
[/code]
PM MAIL ICQ GTalk   Вверх
  
Ответ в темуСоздание новой темы Создание опроса
Правила форума "VB6"
Akina

Запрещается!

1. Публиковать ссылки на вскрытые компоненты

2. Обсуждать взлом компонентов и делиться вскрытыми компонентами

  • Литературу по VB обсуждаем здесь
  • Действия модераторов можно обсудить здесь
  • С просьбами о написании курсовой, реферата и т.п. обращаться сюда
  • Вопросы по реализации алгоритмов рассматриваются здесь
  • Используйте теги [code=vb][/code] для подсветки кода. Используйтe чекбокс "транслит" (возле кнопок кодов) если у Вас нет русских шрифтов.


Если Вам понравилась атмосфера форума, заходите к нам чаще! С уважением, Akina.

 
1 Пользователей читают эту тему (1 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | VB6 | Следующая тема »


 




[ Время генерации скрипта: 0.0461 ]   [ Использовано запросов: 21 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.