# include "stdafx.h"
# include "afxwinappex.h"
# include "afxdialogex.h"
# include "LaiPuLaser.h"
# include "MainFrm.h"
# include "ChildFrm.h"
# include "LaiPuLaserDoc.h"
# include "LaiPuLaserView.h"
# include "FontTypeMgr.h"
# include "WorkCmdInvoker.h"
# include "ModuleDeviceMgr.h"
# include "ModuleDrawMgr.h"
# include "AuthorityMgr.h"
# include "Layer.h"
# include "FileMgr.h"
//#include "SuperDogMgr.h"
# ifdef _DEBUG
# define new DEBUG_NEW
# endif
// CLaiPuLaserApp
BEGIN_MESSAGE_MAP ( CLaiPuLaserApp , CWinAppEx )
ON_COMMAND ( ID_APP_ABOUT , & CLaiPuLaserApp : : OnAppAbout )
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ļ<EFBFBD> <C4BC> ı <EFBFBD> <EFBFBD> ĵ<EFBFBD> <C4B5> <EFBFBD> <EFBFBD> <EFBFBD>
ON_COMMAND ( ID_FILE_NEW , & CWinAppEx : : OnFileNew )
ON_COMMAND ( ID_FILE_OPEN , & CWinAppEx : : OnFileOpen )
// <20> <> <EFBFBD> <D7BC> ӡ<EFBFBD> <D3A1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
ON_COMMAND ( ID_FILE_PRINT_SETUP , & CWinAppEx : : OnFilePrintSetup )
END_MESSAGE_MAP ( )
// CLaiPuLaserApp <20> <> <EFBFBD> <EFBFBD>
CLaiPuLaserApp : : CLaiPuLaserApp ( )
{
EnableHtmlHelp ( ) ;
m_bHiColorIcons = TRUE ;
// ֧<> <D6A7> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_ALL_ASPECTS ;
# ifdef _MANAGED
// <20> <> <EFBFBD> <EFBFBD> Ӧ<EFBFBD> ó<EFBFBD> <C3B3> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ù<EFBFBD> <C3B9> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʱ֧<CAB1> <D6A7> (/clr)<29> <> <EFBFBD> <EFBFBD> <EFBFBD> ģ<EFBFBD> <C4A3> <EFBFBD> :
// 1) <20> <> <EFBFBD> <EFBFBD> <EFBFBD> д˸ <D0B4> <CBB8> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ã<EFBFBD> <C3A3> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ֧<EFBFBD> ֲ<EFBFBD> <D6B2> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
// 2) <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ŀ<EFBFBD> У <EFBFBD> <D0A3> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 밴<EFBFBD> <EBB0B4> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ˳<EFBFBD> <CBB3> <EFBFBD> <EFBFBD> System.Windows.Forms <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> á<EFBFBD>
System : : Windows : : Forms : : Application : : SetUnhandledExceptionMode ( System : : Windows : : Forms : : UnhandledExceptionMode : : ThrowException ) ;
# endif
//Ϊ CompanyName.ProductName.SubProduct.VersionInformation
SetAppID ( _T ( " LaiPuLaser.AppID.NoVersion " ) ) ;
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ҫ<EFBFBD> ij<EFBFBD> ʼ <EFBFBD> <CABC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> InitInstance <20> <>
}
// Ψһ <CEA8> <D2BB> һ <EFBFBD> <D2BB> CLaiPuLaserApp <20> <> <EFBFBD> <EFBFBD>
CLaiPuLaserApp theApp ;
// CLaiPuLaserApp <20> <> ʼ <EFBFBD> <CABC>
BOOL CLaiPuLaserApp : : InitInstance ( )
{
// <20> <> <EFBFBD> <EFBFBD> һ <EFBFBD> <D2BB> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Windows XP <20> ϵ<EFBFBD> Ӧ<EFBFBD> ó<EFBFBD> <C3B3> <EFBFBD> <EFBFBD> 嵥ָ<E5B5A5> <D6B8> Ҫ
// ʹ <> <CAB9> ComCtl32.dll <20> 汾 6 <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ߰汾<DFB0> <E6B1BE> <EFBFBD> <EFBFBD> <EFBFBD> ÿ<EFBFBD> <C3BF> ӻ<EFBFBD> <D3BB> <EFBFBD> ʽ <EFBFBD> <CABD>
//<2F> <> <EFBFBD> <EFBFBD> Ҫ InitCommonControlsEx()<29> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <F2A3ACBD> <EFBFBD> <DEB7> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ڡ<EFBFBD>
INITCOMMONCONTROLSEX InitCtrls ;
InitCtrls . dwSize = sizeof ( InitCtrls ) ;
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϊ<EFBFBD> <CEAA> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ҫ<EFBFBD> <D2AA> Ӧ<EFBFBD> ó<EFBFBD> <C3B3> <EFBFBD> <EFBFBD> <EFBFBD> ʹ <EFBFBD> õ<EFBFBD>
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> ؼ<EFBFBD> <D8BC> ࡣ
InitCtrls . dwICC = ICC_WIN95_CLASSES ;
InitCommonControlsEx ( & InitCtrls ) ;
CWinAppEx : : InitInstance ( ) ;
if ( ! AfxSocketInit ( ) )
{
AfxMessageBox ( IDP_SOCKETS_INIT_FAILED ) ;
return FALSE ;
}
// <20> <> ʼ <EFBFBD> <CABC> OLE <20> <>
if ( ! AfxOleInit ( ) )
{
AfxMessageBox ( IDP_OLE_INIT_FAILED ) ;
return FALSE ;
}
AfxEnableControlContainer ( ) ;
EnableTaskbarInteraction ( ) ;
// ʹ <> <CAB9> RichEdit <20> ؼ<EFBFBD> <D8BC> <EFBFBD> Ҫ AfxInitRichEdit2()
// AfxInitRichEdit2();
// <20> <> <EFBFBD> <D7BC> ʼ <EFBFBD> <CABC>
// <20> <> <EFBFBD> <EFBFBD> δʹ <CEB4> <CAB9> <EFBFBD> <EFBFBD> Щ<EFBFBD> <D0A9> <EFBFBD> ܲ<EFBFBD> ϣ<EFBFBD> <CFA3> <EFBFBD> <EFBFBD> С
// <20> <> <EFBFBD> տ<EFBFBD> ִ<EFBFBD> <D6B4> <EFBFBD> ļ<EFBFBD> <C4BC> Ĵ<EFBFBD> С <EFBFBD> <D0A1> <EFBFBD> <EFBFBD> Ӧ<EFBFBD> Ƴ<EFBFBD> <C6B3> <EFBFBD> <EFBFBD> <EFBFBD>
// <20> <> <EFBFBD> <EFBFBD> Ҫ<EFBFBD> <D2AA> <EFBFBD> ض<EFBFBD> <D8B6> <EFBFBD> ʼ <EFBFBD> <CABC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ڴ洢<DAB4> <E6B4A2> <EFBFBD> õ<EFBFBD> ע<EFBFBD> <D7A2> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
// TODO: Ӧ<> ʵ<EFBFBD> <CAB5> ĸ<DEB8> <C4B8> ַ<EFBFBD> <D6B7> <EFBFBD> <EFBFBD> <EFBFBD>
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ϊ<EFBFBD> <CEAA> ˾<EFBFBD> <CBBE> <EFBFBD> <EFBFBD> ֯<EFBFBD> <D6AF>
SetRegistryKey ( _T ( " Ӧ<EFBFBD> ó<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ɵı <EFBFBD> <EFBFBD> <EFBFBD> Ӧ<EFBFBD> ó<EFBFBD> <EFBFBD> <EFBFBD> " ) ) ;
# if 1
HANDLE hObject = : : CreateMutex ( NULL , FALSE , _T ( " Laipu " ) ) ;
if ( GetLastError ( ) = = ERROR_ALREADY_EXISTS )
{
CloseHandle ( hObject ) ;
AfxMessageBox ( ( " <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ظ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ,<2C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> в鿴Laipu<70> <75> <EFBFBD> ̣<EFBFBD> " ) ) ;
return FALSE ;
}
# endif
LoadStdProfileSettings ( 10 ) ; // <20> <> <EFBFBD> ر<EFBFBD> INI <20> ļ<EFBFBD> ѡ <EFBFBD> <D1A1> (<28> <> <EFBFBD> <EFBFBD> MRU)
InitContextMenuManager ( ) ;
InitShellManager ( ) ;
InitKeyboardManager ( ) ;
InitTooltipManager ( ) ;
CMFCToolTipInfo ttParams ;
ttParams . m_bVislManagerTheme = TRUE ;
theApp . GetTooltipManager ( ) - > SetTooltipParams ( AFX_TOOLTIP_TYPE_ALL , RUNTIME_CLASS ( CMFCToolTipCtrl ) , & ttParams ) ;
// ע<> <D7A2> Ӧ<EFBFBD> ó<EFBFBD> <C3B3> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ĵ<EFBFBD> ģ<EFBFBD> 塣<EFBFBD> ĵ<EFBFBD> ģ<EFBFBD> <C4A3>
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ĵ<EFBFBD> <C4B5> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ܴ<EFBFBD> <DCB4> ں<EFBFBD> <DABA> <EFBFBD> ͼ֮<CDBC> <D6AE> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
CMultiDocTemplate * pDocTemplate ;
pDocTemplate = new CMultiDocTemplate ( IDR_LAIPU_LASER_MENU ,
RUNTIME_CLASS ( CLaiPuLaserDoc ) ,
RUNTIME_CLASS ( CChildFrame ) , // <20> Զ<EFBFBD> <D4B6> <EFBFBD> MDI <20> ӿ<EFBFBD> <D3BF> <EFBFBD>
RUNTIME_CLASS ( CLaiPuLaserView ) ) ;
if ( ! pDocTemplate )
return FALSE ;
AddDocTemplate ( pDocTemplate ) ;
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> MDI <20> <> <EFBFBD> ܴ<EFBFBD> <DCB4> <EFBFBD>
CMainFrame * pMainFrame = new CMainFrame ;
if ( ! pMainFrame | | ! pMainFrame - > LoadFrame ( IDR_MAINFRAME ) )
{
delete pMainFrame ;
return FALSE ;
}
m_pMainWnd = pMainFrame ;
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> к<EFBFBD> ʱ<D7BA> ŵ<EFBFBD> <C5B5> <EFBFBD> DragAcceptFiles
// <20> <> MDI Ӧ<> ó<EFBFBD> <C3B3> <EFBFBD> <EFBFBD> У <EFBFBD> <D0A3> <EFBFBD> Ӧ<EFBFBD> <D3A6> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> m_pMainWnd ֮<> <D6AE> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> /<2F> <>
m_pMainWnd - > DragAcceptFiles ( ) ;
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> shell <20> <> <EFBFBD> DDE<44> <45> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ļ<EFBFBD> <C4BC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
CCommandLineInfo cmdInfo ;
ParseCommandLine ( cmdInfo ) ;
// <20> <> <EFBFBD> á<EFBFBD> DDE ִ<> С <EFBFBD>
EnableShellOpen ( ) ;
RegisterShellFileTypes ( TRUE ) ;
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ָ<EFBFBD> <D6B8> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EEA1A3> <EFBFBD> <EFBFBD>
// <20> <> /RegServer<65> <72> /Register<65> <72> /Unregserver <20> <> /Unregister <20> <> <EFBFBD> <EFBFBD> Ӧ<EFBFBD> ó<EFBFBD> <C3B3> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> FALSE<53> <45>
if ( ! ProcessShellCommand ( cmdInfo ) )
return FALSE ;
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ѳ<EFBFBD> ʼ <EFBFBD> <CABC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʾ <EFBFBD> <CABE> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> и<EFBFBD> <D0B8> <EFBFBD>
//pMainFrame->ShowWindow(m_nCmdShow);
CChildFrame * pChild = ( CChildFrame * ) pMainFrame - > GetActiveFrame ( ) ;
pChild - > ShowWindow ( SW_SHOWMAXIMIZED ) ; //Ĭ<> <C4AC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
pMainFrame - > ShowWindow ( SW_SHOWMAXIMIZED ) ;
pMainFrame - > UpdateWindow ( ) ;
LaiPuAppInitialize ( ) ;
return TRUE ;
}
void CLaiPuLaserApp : : LaiPuAppInitialize ( )
{
gAuthorityMgr - > SetAuthority ( _FACTORY ) ; //<2F> <> <EFBFBD> ²<EFBFBD> <C2B2> <EFBFBD> <EFBFBD> <EFBFBD> Ҫ<EFBFBD> <D2AA> <EFBFBD> <EFBFBD> Ȩ<EFBFBD> <C8A8>
//<2F> <> ʼ <EFBFBD> <CABC> ȫ<EFBFBD> <C8AB> <EFBFBD> <EFBFBD>
gModuleDrawMgr . Ini ( ) ;
gModuleDeviceMgr . Ini ( ) ;
gModuleDrawMgr . SaveAllModuleProperty ( ) ;
gModuleDeviceMgr . SaveAllModuleProperty ( ) ;
if ( gAuthorityMgr - > IsAutoFactory ( ) = = false )
{
gAuthorityMgr - > Lock ( ) ;
}
//<2F> <> ʼ <EFBFBD> <CABC> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
CFontTypeMgr & FontTypeMgr = CFontTypeMgr : : Instance ( ) ;
FontTypeMgr . Initialize ( ) ;
}
//<2F> ˳<EFBFBD> <CBB3> <EFBFBD> <EFBFBD> <EFBFBD>
void CLaiPuLaserApp : : AppExit ( )
{
CWinApp : : OnAppExit ( ) ;
}
int CLaiPuLaserApp : : ExitInstance ( )
{
//TODO: <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ӵĸ<D3B5> <C4B8> <EFBFBD> <EFBFBD> <EFBFBD> Դ
AfxOleTerm ( FALSE ) ;
gModuleDeviceMgr . OnExitApp ( ) ;
return CWinAppEx : : ExitInstance ( ) ;
}
// CLaiPuLaserApp <20> <> Ϣ<EFBFBD> <CFA2> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
// <20> <> <EFBFBD> <EFBFBD> Ӧ<EFBFBD> ó<EFBFBD> <C3B3> <EFBFBD> <F2A1B0B9> ڡ<EFBFBD> <DAA1> ˵<EFBFBD> <CBB5> <EFBFBD> <EFBFBD> <EFBFBD> CAboutDlg <20> Ի<EFBFBD> <D4BB> <EFBFBD>
# if 1
class CAboutDlg : public CDialogEx
{
public :
CAboutDlg ( ) ;
// <20> Ի<EFBFBD> <D4BB> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
enum { IDD = IDD_ABOUTBOX } ;
protected :
virtual void DoDataExchange ( CDataExchange * pDX ) ; // DDX/DDV ֧<> <D6A7>
virtual BOOL OnInitDialog ( ) ;
// ʵ<> <CAB5>
protected :
DECLARE_MESSAGE_MAP ( )
private :
} ;
BEGIN_MESSAGE_MAP ( CAboutDlg , CDialogEx )
END_MESSAGE_MAP ( )
CAboutDlg : : CAboutDlg ( ) : CDialogEx ( CAboutDlg : : IDD )
{
}
void CAboutDlg : : DoDataExchange ( CDataExchange * pDX )
{
CDialogEx : : DoDataExchange ( pDX ) ;
}
BOOL CAboutDlg : : OnInitDialog ( )
{
CDialogEx : : OnInitDialog ( ) ;
CString AppMakeTime ( " <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʱ<EFBFBD> <EFBFBD> : " ) ;
AppMakeTime + = __DATE__ ;
AppMakeTime + = " " ;
AppMakeTime + = __TIME__ ;
GetDlgItem ( IDC_APP_MAKE_TIME ) - > SetWindowText ( AppMakeTime ) ;
# ifdef USE_SUPER_DOG
GetDlgItem ( IDC_SUPER_DOG_TIME ) - > ShowWindow ( SW_SHOW ) ;
//<2F> <> ʾ <EFBFBD> <CABE> <EFBFBD> ܹ<EFBFBD> <DCB9> <EFBFBD> ʱ<EFBFBD> <CAB1>
int DogYear = 0 ;
int DogMonth = 0 ;
int DogDay = 0 ;
gKernelMode . GetDogTime ( & DogYear , & DogMonth , & DogDay ) ;
CString SuperDogTime ;
SuperDogTime . Format ( _T ( " time %d_%d_%d " ) , DogYear , DogMonth , DogDay ) ;
GetDlgItem ( IDC_SUPER_DOG_TIME ) - > SetWindowText ( SuperDogTime ) ;
# endif
UpdateData ( FALSE ) ;
return TRUE ;
}
# endif
# if 1
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> жԻ<D0B6> <D4BB> <EFBFBD> <EFBFBD> <EFBFBD> Ӧ<EFBFBD> ó<EFBFBD> <C3B3> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
void CLaiPuLaserApp : : OnAppAbout ( )
{
CAboutDlg aboutDlg ;
aboutDlg . DoModal ( ) ;
}
// CLaiPuLaserApp <20> Զ<EFBFBD> <D4B6> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> /<2F> <> <EFBFBD> 淽<EFBFBD> <E6B7BD>
void CLaiPuLaserApp : : PreLoadState ( )
{
BOOL bNameValid ;
CString strName ;
bNameValid = strName . LoadString ( IDS_EDIT_MENU ) ;
ASSERT ( bNameValid ) ;
GetContextMenuManager ( ) - > AddMenu ( strName , IDR_POPUP_EDIT ) ;
}
void CLaiPuLaserApp : : LoadCustomState ( )
{
}
void CLaiPuLaserApp : : SaveCustomState ( )
{
}
// CLaiPuLaserApp <20> <> Ϣ<EFBFBD> <CFA2> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
# endif