Voici ce que j'ai découvert dans crt0.c :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
#ifdef _WINMAIN_
lpszCommandLine = _twincmdln();
mainret = _tWinMain( (HINSTANCE)&__ImageBase,
NULL,
lpszCommandLine,
StartupInfo.dwFlags & STARTF_USESHOWWINDOW
? StartupInfo.wShowWindow
: SW_SHOWDEFAULT
);
#else /* _WINMAIN_ */
_tinitenv = _tenviron;
mainret = _tmain(__argc, _targv, _tenviron);
#endif /* _WINMAIN_ */ |
Je pense qu'à l'exception de ce bloc l'initialisation est la même que _WINMAIN_ soit défini ou pas. Donc corrigez moi si j'ai tort, mais il doit être possible de faire fonctionner une application GUI win32 SANS passer par WinMain().
static HINSTANCE s_Instance; = static_cast<HINSTANCE>(GetModuleHandle(NULL));
Pour récupérer le handle.
Pour récupérer la ligne de commande.
Partager