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

📄 salarymanagement.cpp

📁 这是采用mfc编写的工资管理系统
💻 CPP
字号:
// SalaryManagement.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "SalaryManagement.h"
#include "SalaryManagementDlg.h"
#include "USkin.h"
#include "Login.h"
#include "BasicInfo.h"
#include "FamilyMember.h"
#include "Experience.h"
#include "RewardPunish.h"
#include "StaffDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSalaryManagementApp

BEGIN_MESSAGE_MAP(CSalaryManagementApp, CWinApp)
	//{{AFX_MSG_MAP(CSalaryManagementApp)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG
	ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSalaryManagementApp construction

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

/////////////////////////////////////////////////////////////////////////////
// The one and only CSalaryManagementApp object

CSalaryManagementApp theApp;
//CStaffDlg* m_dlg;

/////////////////////////////////////////////////////////////////////////////
// CSalaryManagementApp initialization

BOOL CSalaryManagementApp::InitInstance()
{
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// 将它设置为包括所有要在应用程序中使用的
	// 公共控件类。
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	// Initialize OLE libraries
	if (!AfxOleInit())
	{
		AfxMessageBox(IDP_OLE_INIT_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

	// Parse the command line to see if launched as OLE server
	if (RunEmbedded() || RunAutomated())
	{
		// Register all OLE server (factories) as running.  This enables the
		//  OLE libraries to create objects from other applications.
		COleTemplateServer::RegisterAll();
	}
	else
	{
		// When a server application is launched stand-alone, it is a good idea
		//  to update the system registry in case it has been damaged.
		COleObjectFactory::UpdateRegistryAll();
	}

	char pathName[MAX_PATH];

	//获得当前文件夹的路径
	GetCurrentDirectory(MAX_PATH,pathName);
	CString str;
	m_CurrentDirectory.Format("%s",pathName);
	
	//获得应用程序的绝对路径名
//	GetModuleFileName(NULL,pathName,MAX_PATH);
//	m_ModuleFileName.Format("%s",pathName);
//	pathName[strlen(pathName)-3]='\0';
	
	//获取配置文件、UDL文件的绝对路径名
//	strcat(pathName,"mdb");

//	strcpy(m_DBFileName,pathName);

	USkinInit(NULL,NULL,_T("5.u3"));//加载皮肤文件

//	SetUDLPath();

	//启动登陆界面
	CLogin log;
	if(IDCANCEL==log.DoModal())
		return FALSE;

	CSalaryManagementDlg dlg;
	m_pMainWnd = &dlg;
	int nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}

	USkinExit();
	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}

void CSalaryManagementApp::SetUDLPath()
{
	char ModuleFileName[MAX_PATH];
	char UDLFileName[MAX_PATH];
	char NewPath[MAX_PATH];
	char ProfileName[MAX_PATH];

	//获取应用程序路径
	GetModuleFileName(NULL,ModuleFileName,MAX_PATH);
	ModuleFileName[strlen(ModuleFileName)-4]='\0';

	//保存路径
	strcpy(ProfileName,ModuleFileName);
	strcpy(NewPath,ModuleFileName);
	strcpy(UDLFileName,ModuleFileName);

	//获得对应的.ini文件和.udl文件路径
	strcat(ProfileName,".ini");
	strcat(UDLFileName,".udl");

	//配置数据源*.udl文件,当路径发生变化时进行修改
	char OldPath[MAX_PATH];
	GetPrivateProfileString("UDL","Path","0",OldPath,MAX_PATH,ProfileName);
}

//注册shockwave flash object控件,控件不能放在有中文的路径下
void CSalaryManagementApp::RegisterFlashControl()
{
/*	TCHAR strCurDrt[500];
	int nLen = ::GetCurrentDirectory(500,strCurDrt);
	if( strCurDrt[nLen]!='\\' )
	{
		strCurDrt[nLen++] = '\\';
		strCurDrt[nLen] = '\0';
	}

	CString strFileName = strCurDrt;
	strFileName +="flash.ocx";
	AfxMessageBox(strFileName);
	HINSTANCE hInst = NULL;
	hInst = LoadLibrary( strFileName );
	if( !hInst )
	{
		AfxMessageBox("加载flash.ocx失败,请检查flash.ocx是否和程序在同一目录下");
	}
	else
	{
		
		REGISTERFUNC pRegister;
		pRegister = GetProcAddress((HMODULE)hInst,"DllRegisterServer" );
		(*pRegister)();
	}*/
}

⌨️ 快捷键说明

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