X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3f8e5072f7391db2158f44c6b9209bbb3db6eb06..6d9022fe3bb50a75b9b5eaf5cf32558e518ba310:/samples/mfc/mfctest.cpp?ds=sidebyside diff --git a/samples/mfc/mfctest.cpp b/samples/mfc/mfctest.cpp index ab1e42de2e..7121cc136c 100644 --- a/samples/mfc/mfctest.cpp +++ b/samples/mfc/mfctest.cpp @@ -46,6 +46,9 @@ // version. Perhaps someone else is a wizard at working out the required settings // in the wxWin library and the sample; then debugging the assert problem may be // easier. +// +// (4) Compiling wxWindows in DLL mode currently includes windows.h, so you must only +// try linking wxWindows statically. // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" @@ -56,8 +59,8 @@ #include "wx/wx.h" -#ifdef _WINDOWS_ -#error Sorry, you need to edit include/wx/wxprec.h, comment out the windows.h inclusion, and recompile. +#if defined(_WINDOWS_) || !wxUSE_MFC +#error Sorry, you need to edit include/wx/msw/setup.h, set wxUSE_MFC to 1, and recompile. #endif #ifdef new @@ -131,9 +134,9 @@ IMPLEMENT_APP(MyApp) // CMainWindow::CMainWindow() { - LoadAccelTable( "MainAccelTable" ); - Create( NULL, "Hello Foundation Application", - WS_OVERLAPPEDWINDOW, rectDefault, NULL, "MainMenu" ); + LoadAccelTable( "MainAccelTable" ); + Create( NULL, "Hello Foundation Application", + WS_OVERLAPPEDWINDOW, rectDefault, NULL, "MainMenu" ); } // OnPaint: @@ -145,16 +148,16 @@ CMainWindow::CMainWindow() // void CMainWindow::OnPaint() { - CString s = "Hello, Windows!"; - CPaintDC dc( this ); - CRect rect; - - GetClientRect( rect ); - dc.SetTextAlign( TA_BASELINE | TA_CENTER ); - dc.SetTextColor( ::GetSysColor( COLOR_WINDOWTEXT ) ); - dc.SetBkMode(TRANSPARENT); - dc.TextOut( ( rect.right / 2 ), ( rect.bottom / 2 ), - s, s.GetLength() ); + CString s = "Hello, Windows!"; + CPaintDC dc( this ); + CRect rect; + + GetClientRect( rect ); + dc.SetTextAlign( TA_BASELINE | TA_CENTER ); + dc.SetTextColor( ::GetSysColor( COLOR_WINDOWTEXT ) ); + dc.SetBkMode(TRANSPARENT); + dc.TextOut( ( rect.right / 2 ), ( rect.bottom / 2 ), + s, s.GetLength() ); } // OnAbout: @@ -167,8 +170,8 @@ void CMainWindow::OnPaint() // void CMainWindow::OnAbout() { - CDialog about( "AboutBox", this ); - about.DoModal(); + CDialog about( "AboutBox", this ); + about.DoModal(); } void CMainWindow::OnTest() @@ -187,11 +190,11 @@ void CMainWindow::OnTest() // receive no arguments and are void of return type, e.g., "void OnAbout()". // BEGIN_MESSAGE_MAP( CMainWindow, CFrameWnd ) - //{{AFX_MSG_MAP( CMainWindow ) - ON_WM_PAINT() - ON_COMMAND( IDM_ABOUT, OnAbout ) - ON_COMMAND( IDM_TEST, OnTest ) - //}}AFX_MSG_MAP + //{{AFX_MSG_MAP( CMainWindow ) + ON_WM_PAINT() + ON_COMMAND( IDM_ABOUT, OnAbout ) + ON_COMMAND( IDM_TEST, OnTest ) + //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// @@ -206,16 +209,16 @@ END_MESSAGE_MAP() // BOOL CTheApp::InitInstance() { - TRACE( "HELLO WORLD\n" ); + TRACE( "HELLO WORLD\n" ); - SetDialogBkColor(); // hook gray dialogs (was default in MFC V1) + SetDialogBkColor(); // hook gray dialogs (was default in MFC V1) wxEntry((WXHINSTANCE) m_hInstance, (WXHINSTANCE) m_hPrevInstance, m_lpCmdLine, m_nCmdShow, FALSE); /* - m_pMainWnd = new CMainWindow(); - m_pMainWnd->ShowWindow( m_nCmdShow ); - m_pMainWnd->UpdateWindow(); + m_pMainWnd = new CMainWindow(); + m_pMainWnd->ShowWindow( m_nCmdShow ); + m_pMainWnd->UpdateWindow(); */ if (wxTheApp && wxTheApp->GetTopWindow()) @@ -223,7 +226,7 @@ BOOL CTheApp::InitInstance() m_pMainWnd = new CDummyWindow((HWND) wxTheApp->GetTopWindow()->GetHWND()); } - return TRUE; + return TRUE; } int CTheApp::ExitInstance()