// a1.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "a1.h"
#include "a1Dlg.h"
#include "MyFrame.h"
#include "ScrollPrintDoc.h"
#include "ScrollPrintView.h"
#include "myfunction.h"
#include "DlgLogin.h"
#ifdef _DEBUG
#include "TRACEWIN.H"
#endif
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CA1App
BEGIN_MESSAGE_MAP(CA1App, CWinApp)
//{{AFX_MSG_MAP(CA1App)
//}}AFX_MSG_MAP
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
ON_COMMAND( ID_FILE_PRINT_SETUP, OnFilePrintSetup )
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CA1App construction
CA1App::CA1App()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
// this->m_sUserName;
// this->m_sPurview="0";
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CA1App object
CA1App theApp;
/////////////////////////////////////////////////////////////////////////////
// CA1App initialization
BOOL CA1App::InitInstance()
{
// CG : Initialize OLE libraries
if (!AfxOleInit())
{
AfxMessageBox(_T("OLE initialization failed."));
return FALSE;
}
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
#ifdef _DEBUG
CMfxTrace::Init();
#endif
this->SetRegistryKey("医药管理系统");
WriteProfileInt("Settings", "x", 23);
WriteProfileInt("Settings", "y", 12);
WriteProfileInt("Settings", "cx", 32);
WriteProfileInt("Settings", "cy", 1233);
WriteProfileInt("Settings", "TraceWhere", 23);
if(LRunSql::InitConnectPtr()==false) //初始化COM环境,进行数据库连接
return false;
pDocTemplate = new LSingleDocTemplate(
IDR_MENU_MYFRAME,
RUNTIME_CLASS(CScrollPrintDoc),
RUNTIME_CLASS(CMyFrame), // main SDI frame window
RUNTIME_CLASS(CScrollPrintView));
AddDocTemplate(pDocTemplate);
CMemoryState mem;
mem.Checkpoint();
CDlgLogin dlg; //创建登录窗口对象
if(dlg.DoModal()==IDOK) //显示登录窗口
{
CA1Dlg *pdlg=new CA1Dlg;//创建主窗口对象
m_pMainWnd = pdlg;
pdlg->DoModal(); //显示主窗口
delete pdlg;
pdlg=NULL;
}
mem.DumpAllObjectsSince();
LRunSql::Close(); //断开数据库连接
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}