?? mainfrm.cpp
字號:
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "CTSClient.h"
#include "About.h"
#include "AppHelp.h"
#include "Modify.h"
#include "LoadClass.h"
#include "UnloadClass.h"
#include "MainFrm.h"
//#include "Init.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern SOCKET clientSocket;
/////////////////////////////////////////////////////////////////////
extern SOCKET testSocket;
extern BOOL socketconnect;
/////////////////////////////////////////////////////////////////////
const DWORD dwAdornmentFlags = 0; // exit button
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
ON_COMMAND(ID_EXIT, OnExit)
ON_COMMAND(ID_HELP, OnHelp)
ON_COMMAND(ID_MODIFY_PASSWORD, OnModifyPassword)
ON_COMMAND(ID_LOAD_LIST, OnLoadList)
ON_COMMAND(ID_UNLOAD_LIST, OnUnloadList)
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
////////////////////////////////////////////////////////////
void ThreadFunc()
{
char recvtemp[64];
int retint=recv(testSocket,recvtemp,64,0);
AfxMessageBox(_T("與服務器連接中斷,請檢查網絡!"),0,0);
socketconnect=false;
return;
}
/////////////////////////////////////////////////////////////
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
//////////////////////////////////////////////////////////
//Init *dlg = new Init(this);
//dlg->Create(Init::IDD,this);
//dlg->ShowWindow(SW_SHOW);
//dlg->UpdateWindow();
//////////////////////////////////////////////////////////
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if(!m_wndCommandBar.Create(this) ||
!m_wndCommandBar.InsertMenuBar(IDR_MAINFRAME) ||
!m_wndCommandBar.AddAdornments(dwAdornmentFlags))
{
TRACE0("Failed to create CommandBar\n");
return -1; // fail to create
}
m_wndCommandBar.SetBarStyle(m_wndCommandBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_FIXED);
////////////////////////////////////////////////////////////
hThread=CreateThread(NULL,
0,
(LPTHREAD_START_ROUTINE)ThreadFunc,
NULL,
0,
&ThreadID);
/////////////////////////////////////////////////////////////
//Sleep(10000);
//dlg->DestroyWindow();
//////////////////////////////////////////////////////////////
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
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
void CMainFrame::OnAppAbout()
{
// TODO: Add your command handler code here
About aboutDlg;
aboutDlg.DoModal();
}
void CMainFrame::OnExit()
{
// TODO: Add your command handler code here
PostMessage(WM_QUIT);
}
void CMainFrame::OnHelp()
{
// TODO: Add your command handler code here
AppHelp helpDlg;
helpDlg.DoModal();
}
void CMainFrame::OnModifyPassword()
{
// TODO: Add your command handler code here
Modify modifyDlg;
modifyDlg.DoModal();
}
void CMainFrame::OnLoadList()
{
// TODO: Add your command handler code here
LoadClass loadClassDlg;
loadClassDlg.DoModal();
}
void CMainFrame::OnUnloadList()
{
// TODO: Add your command handler code here
UnloadClass UnloadClassDlg;
UnloadClassDlg.DoModal();
}
void CMainFrame::OnClose()
{
// TODO: Add your message handler code here and/or call default
closesocket(clientSocket);
closesocket(testSocket);
WSACleanup();
CFrameWnd::OnClose();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -