I'm currently trying to hook the "MessageBeep" function in user32.dll by using EasyHook. If im running [this example][1] everything seems to work fine. But if I replace the thread-ID in lines 52 and 60 with the thread-ID of my test application the hook does not apply for the ohter program.
Why is the SetExclusiveACL-Method not accepting any other thread-Ids? e.g.
hook.ThreadACL.SetExclusiveACL(new int[] { 8788 });
I'm using the following Code to retrieve the thread-ID of my test application and to verify if the hook works on the MessageBeep function:
Sub Main()
While True
Console.WriteLine(GetCurrentThreadId().ToString)
MessageBeep(&H40)
If Console.ReadKey().KeyChar = "c"c Then
Console.Clear()
End If
End While
End Sub