www.pudn.com > 200410111016053551.rar > MainFrm.cpp, change:2001-11-21,size:3556b


// MainFrm.cpp : implementation of the CMainFrame class 
// 
 
#include "stdafx.h" 
#include "TCPServer.h" 
#include "MainFrm.h" 
#include "SendVw.h" 
#include "TCPServerDoc.h" 
#include "TCPServerView.h" 
//#include "ReqSocket.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CMainFrame 
 
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) 
 
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) 
	//{{AFX_MSG_MAP(CMainFrame) 
	ON_WM_CREATE() 
//	ON_MESSAGE(WM_CLOSEREQSOCKET, OnCloseReqSocket) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
static UINT indicators[] = 
{ 
	ID_SEPARATOR,           // status line indicator 
	ID_INDICATOR_CAPS, 
	ID_INDICATOR_NUM, 
	ID_INDICATOR_SCRL, 
}; 
 
///////////////////////////////////////////////////////////////////////////// 
// CMainFrame construction/destruction 
 
CMainFrame::CMainFrame() 
{ 
	// TODO: add member initialization code here 
	 
} 
 
CMainFrame::~CMainFrame() 
{ 
} 
 
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{ 
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1) 
		return -1; 
	 
/*	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP 
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || 
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) 
	{ 
		TRACE0("Failed to create toolbar\n"); 
		return -1;      // fail to create 
	} 
*/ 
	if (!m_wndStatusBar.Create(this) || 
		!m_wndStatusBar.SetIndicators(indicators, 
		  sizeof(indicators)/sizeof(UINT))) 
	{ 
		TRACE0("Failed to create status bar\n"); 
		return -1;      // fail to create 
	} 
 
	// TODO: Delete these three lines if you don't want the toolbar to 
	//  be dockable 
//	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); 
//	EnableDocking(CBRS_ALIGN_ANY); 
//	DockControlBar(&m_wndToolBar); 
	CenterWindow(); 
	return 0; 
} 
 
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) 
{ 
	if( !CFrameWnd::PreCreateWindow(cs) ) 
		return FALSE; 
	// TODO: Modify the Window class or styles here by modifying 
	//  the CREATESTRUCT cs 
	cs.dwExStyle &= ~WS_EX_CLIENTEDGE; 
	cs.style &= ~FWS_ADDTOTITLE; 
	cs.cx = 640; 
	cs.cy = 480; 
	return TRUE; 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CMainFrame diagnostics 
 
#ifdef _DEBUG 
void CMainFrame::AssertValid() const 
{ 
	CFrameWnd::AssertValid(); 
} 
 
void CMainFrame::Dump(CDumpContext& dc) const 
{ 
	CFrameWnd::Dump(dc); 
} 
 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CMainFrame message handlers 
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)  
{ 
	// TODO: Add your specialized code here and/or call the base class 
	if (m_wndSplitter.CreateStatic(this,2,1)) 
	{ 
		CRect rect; 
		GetClientRect(&rect); 
		CSize size = rect.Size(); 
		size.cy /= 3; 
		size.cy *= 2; 
		if (m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CTCPServerView),size,pContext)) 
		{ 
			if (m_wndSplitter.CreateView(1,0,RUNTIME_CLASS(CSendEdit),CSize(0,0),pContext)) 
			{ 
				SetActiveView((CView*)m_wndSplitter.GetPane(1,0)); 
				return TRUE; 
			} 
		} 
	} 
	return FALSE; 
//	return CFrameWnd::OnCreateClient(lpcs, pContext); 
} 
 
///////////////////////////////////////////////////////////////////////////// 
/*void CMainFrame::OnCloseReqSocket(WPARAM wParam, LPARAM lParam) 
{ 
	CReqSocket *pSocket=(CReqSocket *)lParam; 
	if (pSocket != NULL) 
	{ 
		delete pSocket; 
		pSocket = NULL; 
	} 
} 
*/