I was wondering, is it possible to use the entry point of a win32 program - the WinMain - as a class method? For example;
class cApp {
public:
cApp();
~cApp();
cGuiManager* guiManager;
cServerManager* serverManager;
cAudioManager* audioManager;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hInst, LPSTR lpCmdLine, int nCmdShow);
static LRESULT CALLBACK WndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);
};
Thanks!
No. WinMain
cannot be a member of class as "entry" point of the program. And for that matter, WinMain
cannot be in any namespace (other than the global namespace). For example, even user::WinMain
as shown below cannot be the "entry" point of the program.
namespace user
{
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int );
}
Entry point of the program must be defined in the global namespace.
However, you can have a function with this name inside a class (or in some other namespace), which you can call from the actual entry point WinMain
defined in the global namespace. ButcApp::WinMain
(or user::WinMain
) is in no way the "entry" point of the program.