The AttachThreadInput function attaches the input processing mechanism of one thread to that of another thread.
BOOL AttachThreadInput(
DWORD idAttach, |
// thread to attach |
DWORD idAttachTo, |
// thread to attach to |
BOOL fAttach |
// attach or detach |
); |
A thread cannot attach to itself. Therefore, idAttachTo cannot equal idAttach.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. There is no extended error information; do not call GetLastError.
Windows created in different threads typically process input independently of each other. That is, they have their own input states (focus, active, capture windows, key state, queue status, and so on), and they are not synchronized with the input processing of other threads. By using the AttachThreadInput function, a thread can attach its input processing to another thread. This also allows threads to share their input states, so they can call the SetFocus function to set the keyboard focus to a window of a different thread. This also allows threads to get key-state information. These capabilities are not generally possible.
The AttachThreadInput function fails if either of the specified threads does not have a message queue. The system creates a thread's message queue when the thread makes its first call to one of the Win32 USER or GDI functions. The AttachThreadInput function also fails if a journal record hook is installed. Journal record hooks attach all input queues together.
Note that key state, which can be ascertained by calls to the GetKeyState or GetKeyboardState function, is reset after a call to AttachThreadInput.
Windows NT: You cannot attach a thread to a thread in another desktop.
GetCurrentThreadId, GetKeyState, GetKeyboardState, GetWindowThreadProcessId, SetFocus
file: /Techref/os/win/api/win32/func/src/f03_1.htm, 4KB, , updated: 2000/4/7 11:19, local time: 2024/12/28 13:39,
3.135.206.138:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/techref/os/win/api/win32/func/src/f03_1.htm"> AttachThreadInput</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to ecomorder.com! |
.