X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9a83f860948059b0273b5cc6d9e43fadad3ebfca..8a31648287be0ef976f133de2786b137f1e98340:/samples/mfc/mfctest.cpp?ds=sidebyside diff --git a/samples/mfc/mfctest.cpp b/samples/mfc/mfctest.cpp index ec1fbfc480..31a7ded470 100644 --- a/samples/mfc/mfctest.cpp +++ b/samples/mfc/mfctest.cpp @@ -39,7 +39,7 @@ // nmake -f makefile.vc BUILD=debug SHARED=0 DEBUG_RUNTIME_LIBS=0 RUNTIME_LIBS=static all // // Unless the run-time library settings match for wxWidgets and MFC, you -// will get link errors for symbols such as __mbctype, __argc, and __argv +// will get link errors for symbols such as __mbctype, __argc, and __argv // // (3) If you see bogus memory leaks within the MSVC IDE on exit, in this // sample or in your own project, you must be using __WXDEBUG__ + @@ -49,10 +49,18 @@ // first: mfc[version][u]d.lib // - [version] -> 42 or 70 or 80 etc // - u if using Unicode -// -// (4) Unicode builds may produce the linker error "unresolved external symbol _WinMain@16". -// MFC requires you to manually add the Unicode entry point to the linker settings, -// Entry point symbol -> wWinMainCRTStartup + +// Disable deprecation warnings from headers included from stdafx.h for VC8+ +#ifndef _CRT_SECURE_NO_WARNINGS + #define _CRT_SECURE_NO_WARNINGS +#endif + +// Also define WINVER to avoid warnings about it being undefined from the +// platform SDK headers (usually this is not necessary because it is done by wx +// headers but here we include the system ones before them) +#ifndef WINVER + #define WINVER 0x0600 +#endif #include "stdafx.h" @@ -128,6 +136,18 @@ DECLARE_APP(MyApp) // notice use of IMPLEMENT_APP_NO_MAIN() instead of the usual IMPLEMENT_APP! IMPLEMENT_APP_NO_MAIN(MyApp) +#ifdef _UNICODE +// In Unicode build MFC normally requires to manually change the entry point to +// wWinMainCRTStartup() but to avoid having to modify the project options to do +// it we provide an adapter for it. +extern "C" int wWinMainCRTStartup(); + +int WINAPI WinMain(HINSTANCE, HINSTANCE, char *, int) +{ + wWinMainCRTStartup(); +} +#endif // _UNICODE + CMainWindow::CMainWindow() { LoadAccelTable( wxT("MainAccelTable") );