Desktop Functions: Smart Device Functions:
|
Search Results for "GetCurrentThreadId" in [All]user32var curThreadId = GetCurrentThreadId(); uint appThread = GetCurrentThreadId(); AppDomain.GetCurrentThreadId is marked as deprecated in favour of Thread.ManagedThreadId but this will not to work with unmanaged API. You can use the GetCurrentThreadId API as well:
SetWindowsHookEx(HookType.WH_KEYBOARD, this.myCallbackDelegate, IntPtr.Zero, AppDomain.GetCurrentThreadId());
SetWindowsHookEx(HookType.WH_KEYBOARD, Me.myCallbackDelegate, IntPtr.Zero, AppDomain.GetCurrentThreadId()) kernel32This does not return a real handle, but a fixed value which is interpreted as the current, calling thread by any function which requires a thread handle. To get the real handle, you need to call GetCurrentThreadId, then OpenThread with the returned value along with the necessary permissions and what-not. Then close the handle when you're done with it.
static extern uint GetCurrentThreadId();
Public Shared Function GetCurrentThreadId() As UInteger
System.AppDomain.GetCurrentThreadId() (This is deprecated in .NET 2.0)
threadId = (uint)AppDomain.GetCurrentThreadId(); dbghelp
static extern uint GetCurrentThreadId();
info.ThreadId = GetCurrentThreadId(); |