www.pudn.com > VX.rar > DTASvm.cpp
// DTASvm.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "DTASvm.h"
#include "MainFrm.h"
#include "DTASvmDoc.h"
#include "DTASvmView.h"
#include "TextTrans.h" //透明文字类
#include "BtnSt.h" //按钮类
#include "Splash.h"
#include "SplashBox.h" //主题对话框
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDTASvmApp
BEGIN_MESSAGE_MAP(CDTASvmApp, CWinApp)
//{{AFX_MSG_MAP(CDTASvmApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
ON_COMMAND(ID_APP_SPLASH, OnAppSplash)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CDTASvmApp construction
CDTASvmApp::CDTASvmApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CDTASvmApp object
CDTASvmApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CDTASvmApp initialization
BOOL CDTASvmApp::InitInstance()
{
// CG: The following block was added by the Splash Screen component.
\
{
\
CCommandLineInfo cmdInfo;
\
ParseCommandLine(cmdInfo);
\
\
CSplashWnd::EnableSplashScreen(cmdInfo.m_bShowSplash);
\
}
AfxEnableControlContainer();
ImportStateWos(); //打开保存状态文件。
// 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
// 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("DTASvm"));
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// 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(CDTASvmDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CDTASvmView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
m_pMainWnd->UpdateWindow();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
CAnimateCtrl m_animate; //视频
CTextTrans m_stcTel; //电话
CTextTrans m_stcName; //名称
CTextTrans m_stcCopyright; //版本信息
CTextTrans m_stcText; //Control类型的文本"口令:"
CEdit m_edtPassword; //Control类型的口令编辑框
CString m_strPassword; //Value 类型的口令编辑框
CButtonST m_btnIcon; //主对话框上的图标
CButtonST m_btnOk; //确定按钮
CButtonST m_btnExit; //退出按钮
CHyperLink m_hyperLink1; //超链接>>个人主页
CHyperLink m_hyperLink2; //超链接>>电子邮件
//}}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 OnBtnicon();
afx_msg void OnCancle();
//}}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_ANIMATE, m_animate);
DDX_Control(pDX, IDC_TEXTTEL, m_stcTel);
DDX_Control(pDX, IDC_TEXTNAME, m_stcName);
DDX_Control(pDX, IDC_TEXTCOPYRIGHT, m_stcCopyright);
DDX_Control(pDX, IDC_STATIC_PASSWORD, m_stcText);
DDX_Control(pDX, IDC_DLG_PASSWORD, m_edtPassword);
DDX_Text(pDX, IDC_DLG_PASSWORD, m_strPassword);
DDV_MaxChars(pDX, m_strPassword, 16);
DDX_Control(pDX, IDC_BTNICON, m_btnIcon);
DDX_Control(pDX, IDOK, m_btnOk);
DDX_Control(pDX, IDCANCLE, m_btnExit);
DDX_Control(pDX, IDC_URL_HOMEPAGE, m_hyperLink1);
DDX_Control(pDX, IDC_URL_EMAILME, m_hyperLink2);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
ON_BN_CLICKED(IDC_BTNICON, OnBtnicon)
ON_BN_CLICKED(IDCANCLE, OnCancle)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CDTASvmApp::OnAppAbout()
{
/////////////////////////// 获取并解密 //////////////////////////////////
CString strReg = AfxGetApp()->GetProfileString("Settings","UserID");
int num = strReg.GetLength();
for(int i=0;i设置个性按钮>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
/*当m_bDrawTransparent变量为TRUE时,以下注释掉的部分不起作用*/
//COLORREF crStandard = ::GetSysColor(COLOR_BTNFACE);
m_btnOk.m_bDrawTransparent = TRUE;
m_btnOk.SetIcon(IDI_OKIN,IDI_OKOUT);
m_btnOk.SetBtnCursor(IDC_HAND);
//m_btnOk.SetFlat(FALSE);
//m_btnOk.SetInactiveBgColor(crStandard);
//m_btnOk.SetActiveBgColor(crStandard + RGB(20,20,20));
m_btnExit.m_bDrawTransparent = TRUE;
m_btnExit.SetIcon(IDI_EXITIN,IDI_EXITOUT);
m_btnExit.SetBtnCursor(IDC_HAND);
//m_btnExit.SetFlat(FALSE);
//m_btnExit.SetInactiveBgColor(crStandard + RGB(20,20,20));
//m_btnExit.SetActiveBgColor(crStandard + RGB(20,20,20));
m_btnIcon.m_bDrawTransparent = TRUE;
m_btnIcon.SetIcon(IDR_MAINFRAME);
m_btnIcon.DrawBorder(FALSE);
m_btnIcon.SetBtnCursor(IDC_HAND);
m_btnIcon.SetAlign(CButtonST::ST_ALIGN_VERT);
m_btnIcon.SetInactiveFgColor(RGB(0,128,92));//字体默认颜色
m_btnIcon.SetActiveFgColor(RGB(128,0,0)); //字体动态颜色
// 2>设置超文本URL>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
/*以下三个颜色变量决定超文本的三态颜色。若不想用默认值,请自定义*/
//m_hyperLink1.m_crLinkColour = RGB( 0, 128, 128); // Dark Green
//m_hyperLink1.m_crVisitedColour = RGB( 26, 85, 139); // Dark Blue
//m_hyperLink1.m_crHoverColour = RGB(139, 85, 26); // Dark Red
m_hyperLink1.SetURL(_T("http://summerplq.51.net")); //访问主页
m_hyperLink1.SetUnderline(FALSE); //下划线
/*同上*/
m_hyperLink2.SetURL(_T("mailto:aulee@vip.sina.com")); //电子邮件
m_hyperLink2.SetUnderline(FALSE); //下划线
// 3>设置视频播放>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
m_animate.Open(IDR_AVI2); //打开视频
m_animate.Play(0,-1,-1); //播放视频
// 4>隐藏部分控件>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if(bEFlag)
{
m_edtPassword.EnableWindow(FALSE); //口令输入框
m_stcText.EnableWindow(FALSE); //文本“口令”
m_btnExit.EnableWindow(FALSE); //退出按钮
// m_edtPassword.ShowWindow(SW_HIDE); //口令输入框
// m_stcText.ShowWindow(SW_HIDE); //文本“口令”
// m_btnExit.ShowWindow(SW_HIDE); //退出按钮
}
return TRUE;
}
void CAboutDlg::OnBtnicon()
{
//图标链接主页
m_hyperLink1.GotoURL("http://summerplq.51.net", SW_SHOW);
}
void CAboutDlg::OnCancle()
{
if(!bEFlag)
{
AfxGetMainWnd()->SendMessage(WM_CLOSE);
exit(0);
}
SendMessage(WM_COMMAND,IDOK);
}
void CDTASvmApp::ImportStateWos()
{
FILE *fp;
if((fp=fopen("Page.wos","r"))==NULL)
{ Flags_w = 0;
for(int m=0 ; m<5 ; m++) Flags_f[m] = 1;
for(int n=0 ; n<24 ; n++) Flags_c[n] = 0;
}
else
{ fscanf(fp,"%d",&Flags_w);
if(Flags_w == 1)
{ for(int i=0 ; i<5 ; i++) fscanf(fp,"%d",&Flags_f[i]);
for(int j=0 ; j<24 ; j++) fscanf(fp,"%d",&Flags_c[j]);
}
else
{ for(int k=0 ; k<5 ; k++) Flags_f[k] = 1;
for(int l=0 ; l<24 ; l++) Flags_c[l] = 0;
} fclose(fp);
} Flags_w = 0;
}
BOOL CDTASvmApp::PreTranslateMessage(MSG* pMsg)
{
// CG: The following lines were added by the Splash Screen component.
if (CSplashWnd::PreTranslateAppMessage(pMsg))
return TRUE;
return CWinApp::PreTranslateMessage(pMsg);
}
void CDTASvmApp::OnAppSplash()
{
CSplashBox sbox;
sbox.DoModal();
// TODO: Add your command handler code here
}