MFC sample now works properly; WinMain not defined in wxMSW

if wxUSE_MFC is defined.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18294 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2002-12-17 10:52:10 +00:00
parent 71ea40203d
commit 5f7a7263c3
2 changed files with 93 additions and 87 deletions

View File

@@ -89,22 +89,22 @@ CTheApp theApp;
// Define a new application type
class MyApp: public wxApp
{ public:
bool OnInit(void);
wxFrame *CreateFrame(void);
};
bool OnInit(void);
wxFrame *CreateFrame(void);
};
class MyCanvas: public wxScrolledWindow
{
public:
public:
MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size);
void OnPaint(wxPaintEvent& event);
void OnMouseEvent(wxMouseEvent& event);
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
class MyChild: public wxFrame
{
public:
public:
MyCanvas *canvas;
MyChild(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
~MyChild(void);
@@ -113,7 +113,7 @@ class MyChild: public wxFrame
void OnNew(wxCommandEvent& event);
void OnActivate(wxActivateEvent& event);
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
// For drawing lines in a canvas
@@ -190,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()
/////////////////////////////////////////////////////////////////////////////
@@ -215,11 +215,11 @@ BOOL CTheApp::InitInstance()
wxEntry((WXHINSTANCE) m_hInstance, (WXHINSTANCE) m_hPrevInstance, m_lpCmdLine, m_nCmdShow, FALSE);
/*
/*
m_pMainWnd = new CMainWindow();
m_pMainWnd->ShowWindow( m_nCmdShow );
m_pMainWnd->UpdateWindow();
*/
*/
if (wxTheApp && wxTheApp->GetTopWindow())
{
@@ -258,15 +258,15 @@ BOOL CTheApp::OnIdle(LONG lCount)
}
/*********************************************************************
* wxWindows elements
********************************************************************/
* wxWindows elements
********************************************************************/
bool MyApp::OnInit(void)
{
// Don't exit app when the top level frame is deleted
// SetExitOnFrameDelete(FALSE);
// Exit app when the top level frame is deleted
SetExitOnFrameDelete(TRUE);
wxFrame* frame = CreateFrame();
(void) CreateFrame();
return TRUE;
}
@@ -301,7 +301,7 @@ wxFrame *MyApp::CreateFrame(void)
subframe->canvas = canvas;
// Give it scrollbars
// canvas->SetScrollbars(20, 20, 50, 50, 4, 4);
// canvas->SetScrollbars(20, 20, 50, 50, 4, 4);
subframe->Show(TRUE);
// Return the main frame window
@@ -315,7 +315,7 @@ END_EVENT_TABLE()
// Define a constructor for my canvas
MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size):
wxScrolledWindow(parent, -1, pos, size)
wxScrolledWindow(parent, -1, pos, size)
{
}
@@ -362,7 +362,7 @@ BEGIN_EVENT_TABLE(MyChild, wxFrame)
END_EVENT_TABLE()
MyChild::MyChild(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, const long style):
wxFrame(frame, -1, title, pos, size, style)
wxFrame(frame, -1, title, pos, size, style)
{
canvas = NULL;
}

View File

@@ -33,6 +33,12 @@
#include "wx/msw/private.h"
// Don't implement WinMain if we're building an MFC/wxWindows
// hybrid app.
#if wxUSE_MFC && !defined(NOMAIN)
#define NOMAIN 1
#endif
// from src/msw/app.cpp
extern void WXDLLEXPORT wxEntryCleanup();