Last active
February 20, 2020 23:41
-
-
Save nvictor/456ab4bf372cfe78171e9abba4d797a9 to your computer and use it in GitHub Desktop.
Win32 API standard main
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
// Win32 API programs entry point | |
// 1. C might give you a hard time if you don't name the parameters | |
// 2. use __stdcall, which is an alias for WINAPI, which is an alias for APIENTRY, etc... | |
int __stdcall wWinMain( | |
// call it module, not instance (back in the days modules share multiple instances, not anymore). | |
HINSTANCE module, | |
// previous "instance", not often used | |
HINSTANCE previous, | |
// command line arguments | |
// PWSTR is for unicode and PSTR for ascii there is also PTSTR which will automatically select | |
// PWSTR or PSTR if "UNICODE" is defined | |
PWSTR commands, | |
// argument to ShowWindow(), not often used | |
int show | |
) { | |
// alternative to UNREFERENCED_PARAMETER() and (void)() | |
// all of which the compiler should optimize away | |
(previous); | |
(show); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment