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

📄 page5.cpp

📁 功能十分强大的拨号程序
💻 CPP
字号:
///////////////////////////////////////////////////////////////////////
// If this program works, it was written by Alexander Fedorov.
// If not, I don't know who wrote it.
// mailto:lamer2000@hotmail.com
// Home Page: http://members.xoom.com/lamer2000/
// This file is part of Alexf Dialer.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
///////////////////////////////////////////////////////////////////////

// Page5.cpp : implementation file
//

#include "stdafx.h"
#include "Afd.h"
#include "Page5.h"
#include <mmsystem.h>
#include "imapi.h"
#include "ModulVer.h"

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

CString GetVersionInfo(PSTR pszFileName)
{
	CString sss;
	DWORD cbVerInfo, dummy;
	// How big is the version info?
	cbVerInfo = GetFileVersionInfoSize(pszFileName, &dummy);
	if (!cbVerInfo) return sss;
	// Allocate space to hold the info
	PBYTE pVerInfo = new BYTE[cbVerInfo];
	if (!pVerInfo) return sss;
	if (!GetFileVersionInfo(pszFileName, 0, cbVerInfo, pVerInfo))
	return sss;
	char * predefResStrings[] =
	{
		"CompanyName",
		"FileDescription",
		"FileVersion",
		"InternalName",
		"LegalCopyright",
		"OriginalFilename",
		"ProductName",
		"ProductVersion",
		0
	};
	for (unsigned i=0; predefResStrings[i]; i++)
	{
		char szQueryStr[ 0x100 ];
		wsprintf(szQueryStr, "\\StringFileInfo\\040904b0\\%s",
		predefResStrings[i]);
		PSTR pszVerRetVal;
		UINT cbReturn;
		BOOL fFound;
		fFound = VerQueryValue(pVerInfo, szQueryStr,
		(LPVOID *)&pszVerRetVal, &cbReturn);
		if (fFound)
		{
			if (i != 0) sss += " ";
			sss += predefResStrings[i];
			sss += " ";
			sss += pszVerRetVal;
		}
	}
	delete []pVerInfo;
	return sss;
} 

/////////////////////////////////////////////////////////////////////////////
// CPage5 p roperty page

IMPLEMENT_DYNCREATE(CPage5, CPropertyPage)

CPage5::CPage5() : CPropertyPage(CPage5::IDD)
{
	//{{AFX_DATA_INIT(CPage5)
	m_sMail = _T("");
	//}}AFX_DATA_INIT
}

CPage5::~CPage5()
{
}

void CPage5::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPage5)
	DDX_Control(pDX, IDC_STATIC_SRC, m_hlSrc);
	DDX_Control(pDX, IDC_FACE_FRAME, m_wnsFace);
	DDX_Control(pDX, IDC_STATIC_HOMEPAGE2, m_hlMailList);
	DDX_Control(pDX, IDC_STATIC_VERSION, m_stVersion);
	DDX_Control(pDX, IDC_STATIC_MAIL, m_stMail);
	DDX_Control(pDX, IDC_STATIC_HOMEPAGE, m_stHomePage);
	DDX_Text(pDX, IDC_EDIT_MAIL, m_sMail);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPage5, CPropertyPage)
	//{{AFX_MSG_MAP(CPage5)
	ON_WM_DESTROY()
	ON_WM_PAINT()
	ON_BN_CLICKED(IDC_BUTTON_MAIL, OnButtonMail)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPage5 message handlers

CString GetSysVer()
{
	CString sss;
	OSVERSIONINFOEX osvi;
	BOOL bOsVersionInfoEx;
	// Try calling GetVersionEx using the OSVERSIONINFOEX structure,
	// which is supported on Windows 2000.
	// If that fails, try using the OSVERSIONINFO structure.
	ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
	osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
	if( !(bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*) &osvi)))
	{
		// If OSVERSIONINFOEX doesn't work, try OSVERSIONINFO.
		osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
		if (!GetVersionEx((OSVERSIONINFO*) &osvi)) return sss;
	}
	switch (osvi.dwPlatformId)
	{
	case VER_PLATFORM_WIN32_NT:
		// Test for the product.
		if (4 >= osvi.dwMajorVersion) sss += "WinNT/";
		if (5 == osvi.dwMajorVersion) sss += "Win2k/";
		// Test for workstation versus server.
		/*
		if(bOsVersionInfoEx)
		{
            if (osvi.wProductType == VER_NT_WORKSTATION)
				sss += "WStat/";
            if (osvi.wProductType == VER_NT_SERVER)
				sss += "Serv/";
		}
		else
		*/
		{
            HKEY hKey;
            char szProductType[80];
            DWORD dwBufLen;
            RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\ProductOptions", 0, KEY_QUERY_VALUE, &hKey);
            RegQueryValueEx(hKey, "ProductType", NULL, NULL, (LPBYTE) szProductType, &dwBufLen);
            RegCloseKey(hKey);
            if (0 == lstrcmpi("WINNT", szProductType)) sss += "WStat/";
            if (0 == lstrcmpi("SERVERNT", szProductType)) sss += "Serv/";
		}
        break;
	case VER_PLATFORM_WIN32_WINDOWS:
		if ((osvi.dwMajorVersion > 4) || ((osvi.dwMajorVersion == 4) && (osvi.dwMinorVersion > 0)))
			sss += "Win98/";
		else sss += "Win95/";
		break;
	case VER_PLATFORM_WIN32s:
		sss += "Win32s/";
		break;
	}
	// Display version, service pack (if any), and build number.
	sss += osvi.szCSDVersion;
	sss += "/";
	sss += L2S(osvi.dwMajorVersion);
	sss += ".";
	sss += L2S(osvi.dwMinorVersion);
	sss += ".";
	sss += L2S(osvi.dwBuildNumber & 0xFFFF);
	return sss;
}

CString GetWindowsVersion()
{
	OSVERSIONINFO osv;
	osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
	CString WindowsPlatform;
	if (GetVersionEx(&osv))
	{
		// note: szCSDVersion =  service pack  release  
		CString ServiceRelease = osv.szCSDVersion;
		switch(osv.dwPlatformId)
		{
		case VER_PLATFORM_WIN32s: //Win32s on Windows 3.1.
			WindowsPlatform = "Microsoft

⌨️ 快捷键说明

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