Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > C/C++: Системное программирование и WinAPI > Фокус ввода


Автор: akuscher 13.6.2006, 11:01
Уважаемые гуру.
Подскажите, плз, как у знать у какого окна (приложения) сейчас находится фокус ввода. Функция GetFocus() возращает NULL, если щелкаешь мышко по другому окну.  

Автор: _hunter 13.6.2006, 11:23
GetForegroundWindow() 

Автор: akuscher 13.6.2006, 12:22
Тоже не катит, описании функции написано, что работает только внутри процесса. а мне надо, чтобы всегда можно было узнать у какого окна фокус в данный момент 

Автор: Romikgy 13.6.2006, 12:29
Цитата(akuscher @  13.6.2006,  11:22 Найти цитируемый пост)
 работает только внутри процесса

А разве твое приложение не в процессе работает, ты проверь сначало 

Автор: _hunter 13.6.2006, 12:43
akuscher, где ты такое интересное описание вычитал?
:
Цитата

GetForegroundWindow Function

--------------------------------------------------------------------------------

The GetForegroundWindow function returns a handle to the foreground window (the window with which the user is currently working). The system assigns a slightly higher priority to the thread that creates the foreground window than it does to other threads. 

Syntax

HWND GetForegroundWindow(VOID);
Return Value

The return value is a handle to the foreground window. The foreground window can be NULL in certain circumstances, such as when a window is losing activation. 




Function Information

Header Declared in Winuser.h, include Windows.h 
Import library User32.lib 
Minimum operating systems Windows 95, Windows NT 3.1 

See Also

Windows Overview, SetForegroundWindow

 

Автор: Earnest 13.6.2006, 18:48
В дополнение, про GetFocus:
Цитата

The return value is the handle to the window with the keyboard focus. If the calling thread's message queue does not have an associated window with the keyboard focus, the return value is NULL. 
Use the GetForegroundWindow function to retrieve the handle to the window with which the user is currently working. 



 

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)