How can I "hide" WinMain like MFC does?

To help myself better understand C++ and win32 programming I started a DLL project to wrap all the basic stuff up. Now I would like to hide WinMain, but I'm not sure how. Could I just use DLLMain as if it were WinMain? Or can I define WinMain in the DLL and somehow set it as the entry point for whatever program references the DLL?

Thanks.
No. Dlls don't have a WinMain(). You're stuck with DLLMain(), LIBMain(), whatever.

Basically, it works well to put Window Class Registration code in Dlls, preferably in an Initialize() function or something like that. For myself I put such code directly in DLLMain() or code called directly from DLLMain, but I like living dangerously (see Microsofts docs on the Dll Entry Point Function and its limitations). Your window procedures will then be in the dll too.

Not having been brain washed into thinking that every procedural function is evil I feel no overpowering compunction to wrap already working procedural code into class wrappers to somehow make them 'clean and good and proper'. But do what you like.
Not having been brain washed into thinking that every procedural function is evil I feel no overpowering compunction to wrap already working procedural code into class wrappers to somehow make them 'clean and good and proper'. But do what you like.

I'm not trying to make it "clean and good and proper", thanks. I'm trying to eliminate the need to re-type the same old crap I have in every single win32 program I write. Nearly everything I ever put in WinMain is overhead anyway so it makes perfect sense to me to do away with it. Isn't that the point of a wrapper -- to eliminate the overhead?

I realize DLLs don't have WinMain. What I want to know is if and how I can define a function in a DLL and have my application point to it as an entry point? Or what the technical difference would be between using DLLMain and WinMain as an entry point for a win32 application.

I don't know all the details of linking with DLLs but my assumption has been that, with early binding, all the exported functions of a DLL are available to an application before its entry point is called. Please clarify this if you will.
Topic archived. No new replies allowed.