Skip to content

Instantly share code, notes, and snippets.

@nvictor
Last active February 20, 2020 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nvictor/456ab4bf372cfe78171e9abba4d797a9 to your computer and use it in GitHub Desktop.
Save nvictor/456ab4bf372cfe78171e9abba4d797a9 to your computer and use it in GitHub Desktop.
Win32 API standard main
#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