Files
envi-code/SourceCode/Code2026/EarthWormCmd/AboutDlg.cpp
T
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

109 lines
2.9 KiB
C++

#include "stdafx.h"
#include "AboutDlg.h"
IMPLEMENT_DYNAMIC(CAboutDlg, CDialog)
CAboutDlg::CAboutDlg(CWnd* pParent /*=NULL*/)
: CDialog(CAboutDlg::IDD, pParent)
{
}
CAboutDlg::~CAboutDlg()
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
ON_BN_CLICKED(IDOK, &CAboutDlg::OnBnClickedOk)
ON_WM_LBUTTONUP()
END_MESSAGE_MAP()
void CAboutDlg::OnBnClickedOk()
{
OnOK();
}
BOOL CAboutDlg::OnInitDialog()
{
CDialog::OnInitDialog();
ReadVersion();
return TRUE;
}
void CAboutDlg::ReadVersion()
{
TCHAR szfileName[MAX_PATH],szFullPath[MAX_PATH];
GetModuleFileName(_hdllInstance,szfileName,MAX_PATH);
TCHAR drive[_MAX_DRIVE] = _T(""),
dir[_MAX_DIR] = _T(""),
fname[_MAX_FNAME] = _T(""),
ext[_MAX_EXT] = _T("");
//e:\,program files\autodesk\,myarx,exe
_tsplitpath(szfileName, drive, dir, fname, ext);
_tcscpy(szFullPath, drive);
_tcscat(szFullPath, dir);
CString sFullPath = szFullPath;
sFullPath.TrimRight(_T('\\'));
//上一级目录
int nPos = sFullPath.ReverseFind(_T('\\'));
CString sPath = sFullPath.Mid(0,nPos + 1);
sFullPath = sPath + _T("sys\\");
sFullPath += _T("product.ini");
TCHAR szValue[MAX_PATH],szValue2[MAX_PATH];
::GetPrivateProfileString(_T("Product"), _T("CName"), _T(""), szValue, MAX_PATH, sFullPath);
GetDlgItem(IDC_STATIC_SOFT)->SetWindowText(szValue);
::GetPrivateProfileString(_T("Product"), _T("IconFile"), _T(""), szValue, MAX_PATH, sFullPath);
CString sFile = sPath + _T("sys\\") + szValue;
HBITMAP hBitmap = (HBITMAP)LoadImage(NULL,sFile,IMAGE_BITMAP,0,0,LR_CREATEDIBSECTION|LR_DEFAULTSIZE|LR_LOADFROMFILE);
CStatic* pSta = (CStatic*)GetDlgItem(IDC_STATIC_ICON);
pSta->SetBitmap(hBitmap);
::GetPrivateProfileString(_T("Product"), _T("APPVer"), _T(""), szValue, MAX_PATH, sFullPath);
::GetPrivateProfileString(_T("Product"), _T("SubVer"), _T(""), szValue2, MAX_PATH, sFullPath);
CString sText = szValue;
sText += _T(" ");
sText += szValue2;
GetDlgItem(IDC_STATIC_1)->SetWindowText(sText);
//标示从锁中读取
GetDlgItem(IDC_STATIC_2)->SetWindowText(_T(""));
::GetPrivateProfileString(_T("About"), _T("Http"), _T(""), szValue, MAX_PATH, sFullPath);
GetDlgItem(IDC_STATIC_3)->SetWindowText(szValue);
::GetPrivateProfileString(_T("About"), _T("Email"), _T(""), szValue, MAX_PATH, sFullPath);
GetDlgItem(IDC_STATIC_4)->SetWindowText(szValue);
::GetPrivateProfileString(_T("About"), _T("TEL"), _T(""), szValue, MAX_PATH, sFullPath);
GetDlgItem(IDC_STATIC_5)->SetWindowText(szValue);
::GetPrivateProfileString(_T("About"), _T("FAX"), _T(""), szValue, MAX_PATH, sFullPath);
GetDlgItem(IDC_STATIC_6)->SetWindowText(szValue);
::GetPrivateProfileString(_T("About"), _T("CopyRight1"), _T(""), szValue, MAX_PATH, sFullPath);
GetDlgItem(IDC_STATIC_7)->SetWindowText(szValue);
}
void CAboutDlg::OnLButtonUp(UINT nFlags, CPoint point)
{
EndDialog(IDOK);
}