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

📄 myproject.cpp

📁 用VC+SQL实现的物流管理系统 “RxMediaPlayer” 文件夹中存放《物流综合管理系统》中《媒体播放平台》源程序 “数据库设置”文件夹中存放《物流综合管理系统》辅助工具《数据库设置》源程
💻 CPP
字号:
// MyProject.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "MyProject.h"
#include "DllHeader.h"

#include "MainFrm.h"
#include "MyDoc.h"
#include "MyView.h"
#include "DLogin.h"
#include "DMain.h"
#include "DBegin.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMyApp

BEGIN_MESSAGE_MAP(CMyApp, CWinApp)
	//{{AFX_MSG_MAP(CMyApp)
		// 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 print setup command
	ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyApp construction

CMyApp::CMyApp()
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CMyApp object
CString OP;
HINSTANCE hInstance;
RxADO ado;
PrintStruct m_ps;
CMyApp theApp;
bool p_Try;
/////////////////////////////////////////////////////////////////////////////
// CMyApp initialization

BOOL CMyApp::InitInstance()
{
	AfxEnableControlContainer();
#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	// Change the registry key under which our settings are stored.
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization.
	SetRegistryKey(_T("Local AppWizard-Generated Applications"));

	LoadStdProfileSettings();  // Load standard INI file options (including MRU)
	//载入动态库
	hInstance =LoadLibrary("RxDLL.dll");
	//载入RXDLL中的函数
	MoneyToChineseCode=(_MoneyToChineseCode*)GetProcAddress(hInstance,"MoneyToChineseCode");
	CTimeToCString=(_CTimeToCString*)GetProcAddress(hInstance,"CTimeToCString");
	CStringTOCTime=(_CStringTOCTime*)GetProcAddress(hInstance,"CStringTOCTime");
	Padl=(_Padl*)GetProcAddress(hInstance,"Padl");
	CharToLetterCode=(_CharToLetterCode*)GetProcAddress(hInstance,"CharToLetterCode");
	char cPath[_MAX_DIR];
	CString sPath,sMemServer,sMemDataBase,sServer,sDataBase;
	::GetSystemDirectory(cPath,sizeof(cPath));
	sPath.Format("%s\\SYSRX.ini",cPath);
	
	::GetPrivateProfileString("CONFIG","SERVER",NULL,sMemServer.GetBuffer(128),128,sPath);
	::GetPrivateProfileString("CONFIG","DATABASE",NULL,sMemDataBase.GetBuffer(128),128,sPath);
	sServer.Format("%s",sMemServer);
	sDataBase.Format("%s",sMemDataBase);
	if(sServer.IsEmpty()==true)
		sServer="(local)";
	if(sDataBase.IsEmpty()==true)
		sDataBase="wlzhglxt";
	CString ConnertionString;
	ConnertionString.Format("Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=%s;Data Source=%s",sDataBase,sServer);
	if(ado.SetConnection(ConnertionString)==false)
	{
		MessageBox(NULL,"连接服务器失败,请重新配置!","系统提示",MB_OK|MB_ICONSTOP);
		::ShellExecute(NULL, "open", "数据库设置.exe", NULL, NULL, SW_SHOWNORMAL);
		return false;
	}
	cnn=ado.GetConnection();

	p_Try=false;


	// 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(CMyDoc),
		RUNTIME_CLASS(CMainFrame),       // main SDI frame window
		RUNTIME_CLASS(CMyView));
	AddDocTemplate(pDocTemplate);

	CDBegin dlg;
	dlg.DoModal();
	return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMyApp message handlers


CString CMyApp::ShowPath()
{
	CString ReturnPach;
	TCHAR szPath[_MAX_PATH];
	BROWSEINFO bi;
	bi.hwndOwner=NULL;
	bi.pidlRoot=NULL;
	bi.lpszTitle=_T("请选择一个文件夹");
	bi.pszDisplayName=szPath;
	bi.ulFlags=BIF_RETURNONLYFSDIRS;
	bi.lpfn=NULL;
	bi.lParam=NULL;
	LPITEMIDLIST pItemIDList=SHBrowseForFolder(&bi);
	if(pItemIDList)
	{
		if(SHGetPathFromIDList(pItemIDList,szPath))
			ReturnPach=szPath;	
	}
	else
		ReturnPach="";
	return ReturnPach;
}

void CMyApp::Print()
{
	CMyApp* app=(CMyApp*)AfxGetApp();
	main_wnd=app->m_pMainWnd;
	app->m_pDocManager->OnFileNew();

}

int CMyApp::ExitInstance() 
{
	FreeLibrary(hInstance);	
	
	return CWinApp::ExitInstance();
}

⌨️ 快捷键说明

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