AppDomain.GetCurrentThreadID vs Thread.ManagedThreadID for Windows API calls?

前端 未结 5 1627
独厮守ぢ
独厮守ぢ 2021-01-11 10:23

I\'m trying to create a hook to monitor the current position of the mouse cursor. Nothing important, I just need to count some pixels during interface design and wanted to l

5条回答
  •  别那么骄傲
    2021-01-11 10:46

    You could use:

    using System.Diagnostics;
    Process.GetCurrentProcess().Threads[0].Id
    

    instead of

    AppDomain.GetCurrentThreadId()

    The problem is only to find the correct number of the thread if you have more threads than the main thread 0 running.

提交回复
热议问题