📄 pathsim.cpp
字号:
// PathSim.cpp : Defines the class behaviors for the application.
//////////////////////////////////////////////////////////////////////
// Copyright 2000. Moe Wheatley AE4JY <ae4jy@mindspring.com>
//
//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either version 2
//of the License, or any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
////
#include "stdafx.h"
#include "PathSim.h"
#include "MainFrm.h"
#include "PathSimDoc.h"
#include "PathSimView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPathSimApp
BEGIN_MESSAGE_MAP(CPathSimApp, CWinApp)
//{{AFX_MSG_MAP(CPathSimApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
// Standard help commands
ON_COMMAND(ID_HELP_TOPICS, CPathSimApp::OnHelpFinder)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPathSimApp construction
CPathSimApp::CPathSimApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CPathSimApp object
CPathSimApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CPathSimApp initialization
BOOL CPathSimApp::InitInstance()
{
// code to keep a second instance of this program from running and
// if one already is running, make it visable.
::CreateMutex( NULL, TRUE, m_pszExeName);
if( GetLastError() == ERROR_ALREADY_EXISTS)
{
CWnd* pPrevWnd = CWnd::GetDesktopWindow()->GetWindow(GW_CHILD);
while( pPrevWnd ) //go through all windows and find the other instance
{
if( ::GetProp( pPrevWnd->GetSafeHwnd(), m_pszExeName) )
{
if( pPrevWnd->IsIconic() ) //if minimized restore it
pPrevWnd->ShowWindow(SW_RESTORE);
pPrevWnd->SetForegroundWindow(); //put in front
pPrevWnd->GetLastActivePopup()->SetForegroundWindow(); //if has poppup
return FALSE;
}
pPrevWnd = pPrevWnd->GetWindow(GW_HWNDNEXT); //try next one
}
return FALSE;
}
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// The registry key under which the program settings are stored.
SetRegistryKey(_T("AE4JY Software"));
LoadStdProfileSettings(10); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CPathSimDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CPathSimView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
// for use in detecting another instance of this program running
::SetProp( m_pMainWnd->GetSafeHwnd(), m_pszExeName, (HANDLE)1);
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
// No message handlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CPathSimApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CPathSimApp message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -