⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainfrm.cpp

📁 能够实现一些常用的地图转换
💻 CPP
字号:
// MainFrm.cpp : implementation of the CMainFrame class
//

#include "stdafx.h"
#include "CalSurBase.h"
#include "DlalogSurvey.h"
#include "MapMarikdlg.h"
#include "Calgeodlg.h"
#include "Caltuhaolat.h"
#include "Caleight.h"
#include "Splast.h"
#include "CoorChanneDlg.h"
#include "Transfromdlg.h"
#include "CorrGridDlg.h"
#include "MathChangeDlg.h"

#include "MainFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMainFrame

IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)

BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
	//{{AFX_MSG_MAP(CMainFrame)
	ON_WM_CREATE()
	ON_COMMAND(ID_CHASURATOB, OnChasuratob)
	ON_COMMAND(IDC_MENUMAP, OnMenumap)
	ON_COMMAND(IDC_SHOWTEXT, OnShowtext)
	ON_COMMAND(ID_MENUCHANGECOOR, OnMenuchangecoor)
	ON_COMMAND(ID_MENUCOORCALTH, OnMenucoorcalth)
	ON_COMMAND(ID_MENUMAPNEAR, OnMenumapnear)
	ON_COMMAND(ID_MENUDD_DL, OnMenuddDl)
	ON_COMMAND(ID_MENUDL_DD, OnMenudlDd)
	ON_COMMAND(ID_MENU_TRANSFROM, OnMenuTransfrom)
	ON_COMMAND(ID_MENUMAPCORR, OnMenumapcorr)
	ON_COMMAND(IDC_MENU_MAPCHA, OnMenuMapcha)
	ON_COMMAND(ID_APP_EXITBEGIN, OnAppExitbegin)
	//}}AFX_MSG_MAP
	// Global help commands
	ON_COMMAND(ID_HELP_FINDER, CMDIFrameWnd::OnHelpFinder)
	ON_COMMAND(ID_HELP, CMDIFrameWnd::OnHelp)
	ON_COMMAND(ID_CONTEXT_HELP, CMDIFrameWnd::OnContextHelp)
	ON_COMMAND(ID_DEFAULT_HELP, CMDIFrameWnd::OnHelpFinder)
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 (CMDIFrameWnd::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);
	
	while(true)
	{
		//SetCursor(LoadCursor(NULL, IDC_WAIT));
		CSplast spldlg;
		if(spldlg.DoModal()==IDOK)
		{
			break;
		}
	}
	time_t osBinaryTime;  // C run-time time (defined in <time.h>)
	time( &osBinaryTime ) ;  // Get the current time from the 
	CTime newtime( osBinaryTime );  // CTime from C run-time time

	int year=newtime.GetYear();
	int mon=newtime.GetMonth();
	int day=newtime.GetDay();
	
	//if(year!=2002||mon!=1||mon!=2||mon!=3)
	/*
	if(year!=2002)
	{  
	  AfxMessageBox("系统发生未知错误,不能计算");
		exit(1);
	}
    if(mon<1||mon>4)
	{
		AfxMessageBox("系统发生未知错误,不能计算");
		exit(1);
	}
	*/
	return 0;
}

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	//if( !CMDIFrameWnd::PreCreateWindow(cs) )
	//	return FALSE;
    //cs.style = WS_OVERLAPPED | WS_SYSMENU | WS_BORDER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
    //cs.dwExStyle = WS_EX_RIGHTSCROLLBAR;
	//cs.x =(::GetSystemMetrics(SM_CXSCREEN)-cs.cx)/2;
	//cs.y =(::GetSystemMetrics(SM_CYSCREEN)-cs.cy)/2;
	//AfxGetMainWnd()->ShowWindow(SW_SHOWMAXIMIZED);
	return CMDIFrameWnd::PreCreateWindow(cs);
	//return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics

#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
	CMDIFrameWnd::AssertValid();
}

void CMainFrame::Dump(CDumpContext& dc) const
{
	CMDIFrameWnd::Dump(dc);
}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers


BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
	if (CMDIFrameWnd::OnCreateClient(lpcs, pContext))
	{
		m_wndMdiClient.SubclassWindow(m_hWndMDIClient);
		m_wndMdiClient.SetBitmap(IDB_BITSTONE);
		return TRUE;
	}
	else
		return FALSE;		
	//return CMDIFrameWnd::OnCreateClient(lpcs, pContext);
}

void CMainFrame::OnChasuratob() 
{
	CDlalogSurvey dlgsurvey;
	dlgsurvey.DoModal();
}

void CMainFrame::OnMenumap() 
{	
	CMapMarikdlg mapdlg;
	mapdlg.DoModal();
}

void CMainFrame::OnShowtext() 
{
    //if((int)ShellExecute(::GetDesktopWindow(), _T("open"), sFileToExe, NULL, NULL, SW_NORMAL) < 33)
    CString StrShow_File;
	CFileDialog ShoeFile_dlg(true,"*.*",NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,"文本文件(*.txt)|*.txt|所有文件(*.*)|*.*||",NULL);
	ShoeFile_dlg.DoModal();
    StrShow_File=ShoeFile_dlg.GetPathName();

    ShellExecute(::GetDesktopWindow(), _T("open"), StrShow_File, NULL, NULL, SW_NORMAL);
}

void CMainFrame::OnMenuchangecoor() 
{
	CCalgeodlg geodlg;
	geodlg.DoModal();	
}

void CMainFrame::OnMenucoorcalth() 
{
	CCaltuhaolat caldlg;
	caldlg.DoModal();
	
}

void CMainFrame::OnMenumapnear() 
{
	CCaleight dlgeight;
	dlgeight.DoModal();	
}

void CMainFrame::OnMenuddDl() 
{
	CCoorChanneDlg coordlg;
	coordlg.bfselcal = 1;
	coordlg.DoModal();
}

void CMainFrame::OnMenudlDd() 
{
	CCoorChanneDlg coordlg;
	coordlg.bfselcal = 2;
	coordlg.DoModal();
}

void CMainFrame::OnMenuTransfrom() 
{
	CTransfromdlg trandlg;
	trandlg.DoModal();
}

void CMainFrame::OnMenumapcorr() 
{
	CCorrGridDlg corrdlg;
	corrdlg.DoModal();
}

void CMainFrame::OnMenuMapcha() 
{
	CMathChangeDlg mathdlg;
	mathdlg.DoModal();
}

void CMainFrame::OnAppExitbegin() 
{
	int msg=AfxMessageBox("确定退出系统?(Y/N)",MB_YESNO|MB_ICONQUESTION);
	if(msg==IDYES)
	    exit(1);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -