startwindow.cpp
来自「偶作的毕业设计程序」· C++ 代码 · 共 120 行
CPP
120 行
// StartWindow.cpp : implementation file
//
#include "stdafx.h"
#include "softdocsystem.h"
#include "StartWindow.h"
#include "PassWord.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CStartWindow dialog
extern CSoftDocSystemApp theApp;
CStartWindow::CStartWindow(CWnd* pParent /*=NULL*/)
: CDialog(CStartWindow::IDD, pParent)
{
//{{AFX_DATA_INIT(CStartWindow)
m_ConPwd = _T("");
m_ConUser = _T("");
m_ConServer = _T("");
//}}AFX_DATA_INIT
}
void CStartWindow::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CStartWindow)
DDX_Text(pDX, IDC_EDIT2, m_ConPwd);
DDX_Text(pDX, IDC_EDIT1, m_ConUser);
DDX_Text(pDX, IDC_EDIT3, m_ConServer);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CStartWindow, CDialog)
//{{AFX_MSG_MAP(CStartWindow)
ON_BN_CLICKED(IDC_BUTTON1, OnRegSystem)
ON_BN_CLICKED(IDOK, OnSetting)
ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CStartWindow message handlers
void CStartWindow::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
void CStartWindow::OnRegSystem()
{
// TODO: Add your control notification handler code here
CDialog::OnOK();
}
void CStartWindow::OnSetting()
{
// TODO: Add your control notification handler code here
UpdateData();
CString m_Filename=".\\ConnectSource.ini";
theApp.ConnectServer=m_ConServer;
theApp.ConnectUser=m_ConUser;
theApp.ConnectPwd=m_ConPwd;//
WritePrivateProfileString("ConnectSource","Server",m_ConServer,m_Filename);
WritePrivateProfileString("ConnectSource","User",m_ConUser,m_Filename);
WritePrivateProfileString("ConnectSource","PassWord",m_ConPwd,m_Filename);
//
AfxMessageBox("您的数据源已成功设置,\n系统根据本次设置联机数据库!\n如要修改,请重新输入。");
m_ConServer.Empty();
m_ConUser.Empty();
m_ConPwd.Empty();
UpdateData();
}
void CStartWindow::OnCheck1()
{
// TODO: Add your control notification handler code here
CString m_Filename=".\\ConnectSource.ini";
if(((CButton*)GetDlgItem(IDC_CHECK1))->GetCheck())
{theApp.ViewStartup="1";//
WritePrivateProfileString("StartUpId","ShowStartWindow","1",m_Filename);
}
else
{theApp.ViewStartup="0";//
WritePrivateProfileString("StartUpId","ShowStartWindow","0",m_Filename);
}
//
}
int CStartWindow::DoModal()
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::DoModal();
}
BOOL CStartWindow::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
if(theApp.ViewStartup==_T("1"))
((CButton*)GetDlgItem(IDC_CHECK1))->SetCheck(true);
else
((CButton*)GetDlgItem(IDC_CHECK1))->SetCheck(false);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?