Tuesday, October 21, 2014

Moving from a console to a windowed app with a windows entry point (winMain with the expected parameters)

often when i start early iterative development on a project i start from a clean sheet and build up as a console application. sometimes i need to make it a real app and need to move from main() to a real windows entry point like this:

int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow )

To do this in a project originally created as a console application go to the property page for the project by right clicking the project, select Configuration Properties->Linker->System, go to the SubSystem editable property, select System->Subsystem dropdown, select /SUBSYSTEM:WINDOWS.

blammo.

Tested in Visual Studio 2012


No comments: