0

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
}
JMRC
  • 1,473
  • 1
  • 17
  • 36
  • Its not very clear what you are asking here. If you start a program from a DLL, you'd be starting a process. Unless you are loading another dll in which case you can call any function in it you like? – Pete Mar 08 '13 at 12:24
  • `Main` is the first function to be called in every process. Of course there are OS-specific sequences that have to be taken, before `main` can be run. How about an intermediate process as a boot-helper? – bash.d Mar 08 '13 at 12:26
  • @bash.d Not fully true, if you have C++, the constructors of "global" objects are called before main executes. But then gain like Pete, I don't get the gist of the question. – rioki Mar 08 '13 at 14:19
  • @rioki Yes, I know, but that can't be the intention... – bash.d Mar 08 '13 at 14:20
  • sorry for not being clear. – JMRC Mar 08 '13 at 14:27

0 Answers0