create custom main from dll

179 Views Asked by At

I'm creating a layer around .NET and Win API. I need to prepare some things before the users can enter the main function, like calling the GetMessage function.

Is it possible to start a program from a dll, which than calls a custom main function on a separate thread?

It would be easer if I would let GetMessage run on a different thread, but as soon as I call SetWindowsHookEx for WH_MOUSE_LL on the main threat, the mouse slows down tremendously for almost a minute as if I haven't called GetMessage at all. But when I debug in Visual Studio, it does enter GetMessage, so that can't be the problem.

Hope someone can help.

UPDATE

this is what I'm trying to achieve.

user_source(cpp)

include MyDLL
custom main(this main is defined by a user)
{

}

MyDLL (cpp)

main(real starting point of the application)
{
    set the windows hooks
    call the main defined by the user on a different thread
    message loop
}
0

There are 0 best solutions below