// 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"
#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
//
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:
//
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:
//
void CMainWindow::OnAbout()
{
- CDialog about( "AboutBox", this );
- about.DoModal();
+ CDialog about( "AboutBox", this );
+ about.DoModal();
}
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()
/////////////////////////////////////////////////////////////////////////////
//
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())
m_pMainWnd = new CDummyWindow((HWND) wxTheApp->GetTopWindow()->GetHWND());
}
- return TRUE;
+ return TRUE;
}
int CTheApp::ExitInstance()