|
Overview |
|
|
|
Group |
|
|
|
Quick Info
Windows NT
| Yes
| Win95
| Yes
| Win32s
| No
| Import Library
| user32.lib
| Header File
| winuser.h
| Unicode
| No
| Platform Notes
| None
|
|
|
AttachThreadInput
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
| );
|
|
Parameters
idAttach
Specifies the identifier of the thread to be attached to another thread. The
thread to be attached cannot be a system thread.
idAttachTo
Specifies the identifier of the thread to be attached to. This thread cannot
be a system thread.
A thread cannot attach to itself. Therefore, idAttachTo cannot equal idAttach.
fAttach
Specifies whether to attach or detach the threads. If this parameter is TRUE,
the two threads are attached. If the parameter is FALSE, the threads are
detached.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. There is no extended error
information available.
Remarks
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.
See Also
GetCurrentThreadId, GetKeyState, GetKeyboardState, GetWindowThreadProcessId, SetFocus
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|