Hello,
I'm having issues when trying to use the CreateThread WinAPI, and I hope someone here can assist me.
Seems like the callback function is never called for some reason, as the message box never shows, but CreateThread doesn't seem to fail.
Example code:
code:
var thread_id = Interop.Allocate(4);
var func = Interop.GetCallbackPtr("ExampleCallback");
var thread = Interop.Call("kernel32.dll", "CreateThread", null, 0, func, null, 0, thread_id);
if (!thread)
{
Debug.Trace("Could not create thread.");
return;
}
Callback function:
code:
function ExampleCallback(Param)
{
Interop.Call("user32.dll", "MessageBoxW", 0, "It works!", "", 0);
return 1;
}
Any ideas?