<DllImport("user32.dll")> _
Public Shared Function AttachThreadInput(ByVal idAttach As System.UInt32, ByVal idAttachTo As System.UInt32, ByVal fAttach As Boolean) As Boolean
End Function
var idAttach = GetWindowThreadProcessId(hFore, out id);
var curThreadId = GetCurrentThreadId();
// To attach to current thread
AttachThreadInput(idAttach, curThreadId, true);
// To dettach from current thread
AttachThreadInput(idAttach, curThreadId, false);
Alternative Managed API:
Do you know one? Please contribute it!
The AttachThreadInput API
4/21/2021 1:41:34 AM - -185.11.25.251
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.