139 lines
3.4 KiB
C++
139 lines
3.4 KiB
C++
// ResFile.cpp : Defines the class behaviors for the application.
|
|
//
|
|
//----------------- Dundas Software ----------------------------------------
|
|
//========================================================================
|
|
|
|
#include "stdafx.h"
|
|
#include "utsampleabout.h"
|
|
#include "ResFile.h"
|
|
|
|
#include "MainFrm.h"
|
|
#include "ChildFrm.h"
|
|
#include "ResLibDoc.h"
|
|
#include "ResLibView.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CResFileApp
|
|
|
|
BEGIN_MESSAGE_MAP(CResFileApp, CWinApp)
|
|
//{{AFX_MSG_MAP(CResFileApp)
|
|
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
|
|
//}}AFX_MSG_MAP
|
|
// Standard file based document commands
|
|
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
|
|
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CResFileApp construction
|
|
|
|
CResFileApp::CResFileApp()
|
|
{
|
|
m_nClipFormat = 0;
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// The one and only CResFileApp object
|
|
|
|
CResFileApp theApp;
|
|
static HINSTANCE g_hRichEdDLL=NULL;
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CResFileApp initialization
|
|
|
|
BOOL CResFileApp::InitInstance()
|
|
{
|
|
if(!AfxOleInit())
|
|
{
|
|
AfxMessageBox(_T("OLE Failed."), MB_ICONSTOP);
|
|
return FALSE;
|
|
}
|
|
|
|
// Standard initialization
|
|
|
|
#if _MSC_VER < 1400
|
|
#ifdef _AFXDLL
|
|
Enable3dControls(); // Call this when using MFC in a shared DLL
|
|
#else
|
|
Enable3dControlsStatic(); // Call this when linking to MFC statically
|
|
#endif
|
|
#endif
|
|
|
|
|
|
// Initialize RichEdit control
|
|
// for About Dialog
|
|
if(g_hRichEdDLL==NULL)
|
|
{
|
|
g_hRichEdDLL=::LoadLibrary(_T("RICHED32.DLL"));
|
|
if(g_hRichEdDLL==NULL)
|
|
TRACE(_T("Cannot load library to display RichEditTextControl"));
|
|
}
|
|
|
|
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
|
|
|
|
// Register document templates
|
|
|
|
CMultiDocTemplate* pDocTemplate;
|
|
pDocTemplate = new CMultiDocTemplate(
|
|
IDR_RESLIBTYPE,
|
|
RUNTIME_CLASS(CResLibDoc),
|
|
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
|
|
RUNTIME_CLASS(CResLibView));
|
|
AddDocTemplate(pDocTemplate);
|
|
|
|
// create main MDI Frame window
|
|
CMainFrame* pMainFrame = new CMainFrame;
|
|
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
|
|
return FALSE;
|
|
m_pMainWnd = pMainFrame;
|
|
|
|
// Enable drag/drop open
|
|
m_pMainWnd->DragAcceptFiles();
|
|
|
|
// Enable DDE Execute open
|
|
EnableShellOpen();
|
|
RegisterShellFileTypes(TRUE);
|
|
|
|
// 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;
|
|
pMainFrame->ShowWindow(m_nCmdShow);
|
|
pMainFrame->UpdateWindow();
|
|
|
|
m_nClipFormat = (CLIPFORMAT)::RegisterClipboardFormat(_T("DemoOXRes"));
|
|
return TRUE;
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// App command to run the dialog
|
|
void CResFileApp::OnAppAbout()
|
|
{
|
|
CUTSampleAboutDlg aboutDlg(IDR_MAINFRAME,ID_DESCRIPTION_FILE);
|
|
aboutDlg.DoModal();
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CResFileApp commands
|
|
|
|
int CResFileApp::ExitInstance()
|
|
{
|
|
// TODO: Add your specialized code here and/or call the base class
|
|
|
|
// unload the library
|
|
if(g_hRichEdDLL!=NULL)
|
|
::FreeLibrary(g_hRichEdDLL);
|
|
|
|
return CWinApp::ExitInstance();
|
|
}
|