Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2003.04.03;
Скачать: CL | DM;

Вниз

Handle главного окна проги....   Найти похожие ветки 

 
Chlavik ©   (2003-03-20 22:25) [0]

Здравствуйте! Как мне узнать handle главного окна программы если я знаю handle её процеса? handle процеса я достаю из CreateProcess (из структуры PROCESS_INFORMATION) прога которую я запускаю под Dos, вроде всё сказал....


 
VAleksey ©   (2003-03-21 07:25) [1]

Application.MainForm.Handle


 
theodor_iv ©   (2003-03-21 08:30) [2]

Если программа чужая, то EnumThreadWindows


 
Севостьянов Игорь ©   (2003-03-21 15:32) [3]

Используй WinAPI32:

HWND GetWindow(
HWND hWnd, // handle to original window
UINT uCmd // relationship
);
Parameters
hWnd
[in] Handle to a window. The window handle retrieved is relative to this window, based on the value of the uCmd parameter.
uCmd
[in] Specifies the relationship between the specified window and the window whose handle is to be retrieved. This parameter can be one of the following values


Для дочерних uCmd:

GW_CHILD The retrieved handle identifies the child window at the top of the Z order, if the specified window is a parent window; otherwise, the retrieved handle is NULL. The function examines only child windows of the specified window. It does not examine descendant windows.

Для родителей uCmd:

GW_OWNER The retrieved handle identifies the specified window"s owner window, if any. For more information, see Owned Windows.


 
Chlavik ©   (2003-03-21 16:04) [4]

Ну и куда мне писать там handle запущеного процеса? Если (GetWindow) туда надо писать handle окна от которого будем "отталкиватся" ...
Если нельзя сделать проще чем через EnumThreadWindows то прийдётся юзать его...


 
Chlavik ©   (2003-03-21 16:33) [5]

Или писать так WinHndl:=GetWindow(PrHandle,GW_CHILD); ???


 
PGM   (2003-03-24 08:39) [6]

Мне обычно нужна была обратная операция. Для этого случая можно так. Сначала EnumWindows. Там выбрать те у кого нет WS_CHILD. Затем GetWindowThreadProcessId(HWND, @PID). Ну а PID это уже почти Handle. Дальше зависит от ОС. Под NT-подобными я обычно пользовался OpenProcess и получал массу информации о процессе. Для W9X я думаю подойдет библиотека ToolHelp32.


 
PGM   (2003-03-24 08:40) [7]

В твоем случае еще проще. CreateProcess возвращет PID in Process_Information.



Страницы: 1 вся ветка

Текущий архив: 2003.04.03;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.028 c
3-6322
Михаил Баринов
2003-03-17 10:48
2003.04.03
Передача списка значений в параметре (Delphi + Oracle)


3-6336
Gregory
2003-03-14 00:39
2003.04.03
Компонент работы с БД DegysiDB


14-6681
Дмитрий К.К.
2003-03-18 06:17
2003.04.03
Именинники 18 марта


3-6341
VS2002
2003-03-14 10:39
2003.04.03
Как переименовать таблицу в ORACLE


1-6588
Артём К.
2003-03-22 06:38
2003.04.03
Создание пиктограммы для эл-та в ListBoxe