powered by simpleCommunicator - 2.0.60     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Visual Basic [игнор отключен] [закрыт для гостей] / Как узнать активное окно в запущенных процессах Windows?
7 сообщений из 7, страница 1 из 1
Как узнать активное окно в запущенных процессах Windows?
    #32326393
Фотография Nrisimha
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Как узнать активное окно в запущенных процессах Windows?
...
Рейтинг: 0 / 0
Как узнать активное окно в запущенных процессах Windows?
    #32326478
Фотография big-duke
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
если я правильно понял о чем идет речь
Вот что пишет Апплеман
GetActiveWindow

VB Declaration

Declare Function GetActiveWindow& Lib "user32" ()

Description

Obtains the handle of the active window.

Use with VB

No problem.

Return Value

Long—The handle of the active window, or zero if no window is active.

Platform

Windows 95, Windows NT, Win16

Comments

This function is discussed at length within the chapter text.

...
Рейтинг: 0 / 0
Как узнать активное окно в запущенных процессах Windows?
    #32326567
Фотография Nrisimha
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
окей, а как теперь узнать Название_Запушенного активного приложения и процесса? И еще название окна?
...
Рейтинг: 0 / 0
Как узнать активное окно в запущенных процессах Windows?
    #32326589
Фотография Nrisimha
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Делаю так, но у меня не показываются другие приложения если они становятся активными

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
Private Declare Function GetActiveWindow& Lib  "user32"  ()
Private Declare Function GetWindowText Lib  "user32"  Alias  "GetWindowTextA"  (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowThreadProcessId Lib  "user32"  (ByVal hwnd As Long, lpdwProcessId As Long) As Long


Private Sub Timer1_Timer()
Dim tmp
Dim cnt As Long
Dim rttitle As String *  256 
cnt = GetWindowText(GetActiveWindow, rttitle,  255 ) '  232 ; 249 ; 229 ; 236 ;  241 ; 235 ; 229 ; 228 ; 243 ; 254 ; 249 ; 229 ; 229 ;  238 ; 234 ; 237 ; 238 ;
Me.Label2.Caption = rttitle
Me.Label1.Caption = GetActiveWindow
Me.Label4.Caption = GetWindowThreadProcessId(GetActiveWindow, tmp)
Me.Label5.Caption = tmp
End Sub
...
Рейтинг: 0 / 0
Как узнать активное окно в запущенных процессах Windows?
    #32326679
Фотография Nrisimha
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
ПРОШУ ПРОЩЕНИЯ НО
GetActiveWindow

показывает активное окно только моей программы, а мне нужно не только моей!
...
Рейтинг: 0 / 0
Как узнать активное окно в запущенных процессах Windows?
    #32326736
еееееее
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Нашел

GetForegroundWindow Function
Declare Function GetForegroundWindow Lib "user32.dll" () As Long

Platforms: Win 95/98, Win NT

GetForegroundWindow finds which window is currently the foreground window. The foreground window is the window, usually at the top of the Z-order, with which the user is currently working with -- i.e., the window with the focus. The function returns 0 if an error occured, or the handle of the foreground window if successful.

Example:

' Display the title bar text of the foreground window.
Dim hforewnd As Long ' receives handle of foreground window
Dim slength As Long ' length of foreground window's title bar text
Dim wintext As String ' buffer for foreground window's title bar text
Dim retval As Long ' return value

hforewnd = GetForegroundWindow() ' determine the foreground window
slength = GetWindowTextLength(hforewnd) + 1 ' length of its title bar text
wintext = Space(slength) ' make room in the buffer to receive the text
retval = GetWindowText(hforewnd, wintext, slength) ' get title bar text
wintext = Left(wintext, slength - 1) ' remove null character from end of string
Debug.Print "The window "; wintext; " is the foreground window."
See Also: SetForegroundWindow
Category: Windows



КАК ТЕПЕРЬ УЗНАТЬ ПУТЬ И ИМЯ EXE файла по Активному окну ?
...
Рейтинг: 0 / 0
Как узнать активное окно в запущенных процессах Windows?
    #32327329
viper
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
А GetWindowModuleFileName не подойдет?
...
Рейтинг: 0 / 0
7 сообщений из 7, страница 1 из 1
Форумы / Visual Basic [игнор отключен] [закрыт для гостей] / Как узнать активное окно в запущенных процессах Windows?
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]