📄 renshi.cpp
字号:
// Renshi.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "Renshi.h"
#include "MainFrm.h"
#include "LoginDlg.h"
#include "BumenView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRenshiApp
BEGIN_MESSAGE_MAP(CRenshiApp, CWinApp)
//{{AFX_MSG_MAP(CRenshiApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
ON_COMMAND(ID_FILE_NEW, OnFileNew)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRenshiApp construction
CRenshiApp::CRenshiApp()
{
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CRenshiApp object
CRenshiApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CRenshiApp initialization
BOOL CRenshiApp::InitInstance()
{
m_hOneInstance = ::CreateMutex( NULL,FALSE,"Renshi");
if ( GetLastError() == ERROR_ALREADY_EXISTS )
{
MessageBox(NULL,"该程序已经运行了","人事管理系统",MB_ICONINFORMATION|MB_OK);
return FALSE;
}
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"));
// To create the main window, this code creates a new frame window
// object and then sets it as the application's main window object.
CMDIFrameWnd* pFrame = new CMainFrame;
m_pMainWnd = pFrame;
// create main MDI frame window
if (!pFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
HINSTANCE hInst = AfxGetResourceHandle();
m_hMDIAccel = ::LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_RENSHITYPE));
m_hMDIMenu = ::LoadMenu(hInst, MAKEINTRESOURCE(IDR_RENSHITYPE));
m_hMenu = ::LoadMenu(hInst, MAKEINTRESOURCE(IDR_MAINFRAME));
// The main window has been initialized, so show and update it.
//pFrame->ShowWindow(m_nCmdShow);
pFrame->CenterWindow();
pFrame->ShowWindow(SW_SHOW);
pFrame->UpdateWindow();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CRenshiApp message handlers
int CRenshiApp::ExitInstance()
{
if (m_hMDIMenu != NULL)
FreeResource(m_hMDIMenu);
if (m_hMDIAccel != NULL)
FreeResource(m_hMDIAccel);
CloseHandle(m_hOneInstance);
return CWinApp::ExitInstance();
}
void CRenshiApp::OnFileNew()
{
CLoginDlg ld;
if(ld.DoModal() == IDOK)
{
SetMenu(AfxGetMainWnd()->GetSafeHwnd(),m_hMDIMenu);
((CMainFrame*)m_pMainWnd)->SetToolBarShow();
m_pMainWnd->SetWindowText("人事管理系统---已登陆");
}
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
#include "Class\Link.h"
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
CProgressCtrl m_pp;
CLink m_email;
CLink m_qq;
CLink m_web;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
virtual BOOL OnInitDialog();
afx_msg void OnStaticQq();
afx_msg void OnStaticEmail();
afx_msg void OnStaticWeb();
afx_msg void OnTimer(UINT nIDEvent);
virtual void OnOK();
virtual void OnCancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
DDX_Control(pDX, IDC_PROGRESS1, m_pp);
DDX_Control(pDX, IDC_STATIC_EMAIL, m_email);
DDX_Control(pDX, IDC_STATIC_QQ, m_qq);
DDX_Control(pDX, IDC_STATIC_WEB, m_web);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
ON_BN_CLICKED(IDC_STATIC_QQ, OnStaticQq)
ON_BN_CLICKED(IDC_STATIC_EMAIL, OnStaticEmail)
ON_BN_CLICKED(IDC_STATIC_WEB, OnStaticWeb)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CRenshiApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CRenshiApp message handlers
BOOL CAboutDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_qq.SetToolTipText("QQ在线交谈");
m_email.SetToolTipText("发邮件给我");
m_web.SetToolTipText("欢迎访问我的网站!");
m_pp.SetRange(1,100);
m_pp.SetPos(100);
m_pp.SetStep(-1);
SetTimer(1,100,NULL);
return TRUE;
}
void CAboutDlg::OnStaticQq()
{
::ShellExecute(NULL,"open","http://wpa.qq.com/msgrd?V=1&Uin=394468254&Site=人事管理系统&Menu=yes",NULL,NULL,SW_SHOW);
}
void CAboutDlg::OnStaticEmail()
{
::ShellExecute(NULL,"open","mailto:chx20@163.com",NULL,NULL,SW_SHOW);
}
void CAboutDlg::OnStaticWeb()
{
::ShellExecute(NULL,"open","http://www.59hao.com/chx",NULL,NULL,SW_SHOW);
}
void CAboutDlg::OnTimer(UINT nIDEvent)
{
m_pp.StepIt();
if(m_pp.GetPos()==1)
{
KillTimer(1);
OnOK();
}
CDialog::OnTimer(nIDEvent);
}
/**************************AnimateWindow()**************************/
#define AW_HOR_POSITIVE 0x00000001
#define AW_HOR_NEGATIVE 0x00000002
#define AW_VER_POSITIVE 0x00000004
#define AW_VER_NEGATIVE 0x00000008
#define AW_CENTER 0x00000010
#define AW_HIDE 0x00010000
#define AW_ACTIVATE 0x00020000
#define AW_SLIDE 0x00040000
#define AW_BLEND 0x00080000
void CAboutDlg::OnOK()
{
typedef UINT (CALLBACK* LPFUN)(HWND hwnd, DWORD dwTime,DWORD dwFlags);
LPFUN pp;
HINSTANCE hInst=::LoadLibrary("user32.dll");
if(hInst)
{
pp = (LPFUN)::GetProcAddress(hInst, "AnimateWindow" );
pp(GetSafeHwnd(), 300,AW_BLEND|AW_HIDE);
::FreeLibrary(hInst );
}
CDialog::OnOK();
}
void CAboutDlg::OnCancel()
{
typedef UINT (CALLBACK* LPFUN)(HWND hwnd, DWORD dwTime,DWORD dwFlags);
LPFUN pp;
HINSTANCE hInst=::LoadLibrary("user32.dll");
if(hInst)
{
pp = (LPFUN)::GetProcAddress(hInst, "AnimateWindow" );
pp(GetSafeHwnd(), 300,AW_BLEND|AW_HIDE);
::FreeLibrary(hInst );
}
CDialog::OnCancel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -