display version information in about dialog and on the desktop

svn path=/trunk/; revision=10572
This commit is contained in:
Martin Fuchs 2004-08-16 18:49:58 +00:00
parent 5b9f8a442b
commit 7566350740
6 changed files with 125 additions and 14 deletions

View file

@ -299,15 +299,16 @@ void BackgroundWindow::DrawDesktopBkgnd(HDC hdc)
DeleteBrush(bkgndBrush);
*/
if (_display_version) {
static const String s_bkgnd_txt = ResString(IDS_EXPLORER_VERSION_STR) + TEXT("\nby Martin Fuchs");
static const String s_bkgnd_txt = ResString(IDS_EXPLORER_VERSION_STR) + TEXT("\nby Martin Fuchs\n%s");
static String s_version_str = get_windows_version_str();
FmtString txt(s_bkgnd_txt, (LPCTSTR)ResString(IDS_VERSION_STR));
FmtString txt(s_bkgnd_txt, (LPCTSTR)ResString(IDS_VERSION_STR), (LPCTSTR)s_version_str);
ClientRect rect(_hwnd);
rect.left = rect.right - 280;
rect.top = rect.bottom - 56 - DESKTOPBARBAR_HEIGHT;
rect.right = rect.left + 250;
rect.bottom = rect.top + 40;
rect.left = rect.right - 440;
rect.top = rect.bottom - 90 - DESKTOPBARBAR_HEIGHT;
rect.right = rect.left + 420;
rect.bottom = rect.top + 70;
BkMode bkMode(hdc, TRANSPARENT);

View file

@ -568,6 +568,13 @@ struct ExplorerAboutDlg : public
new HyperlinkCtrl(hwnd, IDC_WWW);
FmtString ver_txt(ResString(IDS_EXPLORER_VERSION_STR), (LPCTSTR)ResString(IDS_VERSION_STR));
SetWindowText(GetDlgItem(hwnd, IDC_VERSION_TXT), ver_txt);
HWND hwnd_winver = GetDlgItem(hwnd, IDC_WIN_VERSION);
SetWindowText(hwnd_winver, get_windows_version_str());
SetWindowFont(hwnd_winver, GetStockFont(DEFAULT_GUI_FONT), FALSE);
CenterWindow(hwnd);
}

View file

@ -149,6 +149,8 @@
#define ID_DESKTOP_VERSION 1027
#define IDC_BUTTON1 1028
#define IDC_CHECK_ENTRIES 1028
#define IDC_VERSION_TXT 1029
#define IDC_WIN_VERSION 1030
#define ID_REFRESH 1704
#define ID_ABOUT_WINEFILE 1705
#define IDS_VERSION_STR 5000
@ -204,7 +206,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 166
#define _APS_NEXT_COMMAND_VALUE 40021
#define _APS_NEXT_CONTROL_VALUE 1029
#define _APS_NEXT_CONTROL_VALUE 1030
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View file

@ -428,12 +428,14 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About ReactOS Explorer"
FONT 10, "MS Sans Serif"
BEGIN
LTEXT "ReactOS Explorer",IDC_ROS_EXPLORER,91,29,90,11
LTEXT "(c) 2003/2004 Martin Fuchs",IDC_STATIC,90,50,79,8
LTEXT "ReactOS Explorer",IDC_ROS_EXPLORER,91,13,90,11
LTEXT "(c) 2003/2004 Martin Fuchs",IDC_STATIC,90,42,79,8
LTEXT "http://www.sky.franken.de/explorer/",IDC_WWW,21,84,104,
8
CONTROL "&OK",IDOK,"Button",BS_OWNERDRAW | BS_FLAT | WS_GROUP,
151,90,38,12
LTEXT "V 0.9",IDC_VERSION_TXT,90,27,99,8
LTEXT "",IDC_WIN_VERSION,90,58,99,22
END
@ -498,9 +500,9 @@ BEGIN
"BEGIN\r\n"
"IDS_VERSION_STR """"\r\n"
"#ifdef UNICODE\r\n"
"IDS_EXPLORER_VERSION_STR ""ROS Explorer""\r\n"
"IDS_EXPLORER_VERSION_STR ""ROS Explorer%0s""\r\n"
"#else\r\n"
"IDS_EXPLORER_VERSION_STR ""ROS Explorer Ansi""\r\n"
"IDS_EXPLORER_VERSION_STR ""ROS Explorer Ansi%0s""\r\n"
"#endif\r\n"
"END\r\n"
"#endif\r\n"
@ -1899,9 +1901,9 @@ STRINGTABLE DISCARDABLE
BEGIN
IDS_VERSION_STR ""
#ifdef UNICODE
IDS_EXPLORER_VERSION_STR "ROS Explorer"
IDS_EXPLORER_VERSION_STR "ROS Explorer%0s"
#else
IDS_EXPLORER_VERSION_STR "ROS Explorer Ansi"
IDS_EXPLORER_VERSION_STR "ROS Explorer Ansi%0s"
#endif
END
#endif

View file

@ -206,7 +206,7 @@ BOOL launch_fileA(HWND hwnd, LPSTR cmd, UINT nCmdShow, LPCSTR parameters)
#endif
/* search for already running win[e]files */
/* search for already running instance */
static int g_foundPrevInstance = 0;
@ -236,6 +236,101 @@ int find_window_class(LPCTSTR classname)
}
String get_windows_version_str()
{
OSVERSIONINFOEX osvi = {sizeof(OSVERSIONINFOEX)};
BOOL osvie_val;
String str;
if (!(osvie_val = GetVersionEx((OSVERSIONINFO*)&osvi))) {
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (!GetVersionEx((OSVERSIONINFO*)&osvi))
return TEXT("???");
}
switch(osvi.dwPlatformId) {
case VER_PLATFORM_WIN32_NT:
if (osvi.dwMajorVersion <= 4)
str = TEXT("Microsoft Windows NT");
else if (osvi.dwMajorVersion==5 && osvi.dwMinorVersion==0)
str = TEXT("Microsoft Windows 2000");
else if (osvi.dwMajorVersion==5 && osvi.dwMinorVersion==1)
str = TEXT("Microsoft Windows XP");
if (osvie_val) {
if (osvi.wProductType == VER_NT_WORKSTATION) {
if (osvi.wSuiteMask & VER_SUITE_PERSONAL)
str += TEXT(" Personal");
else
str += TEXT(" Professional");
} else if (osvi.wProductType == VER_NT_SERVER) {
if (osvi.wSuiteMask & VER_SUITE_DATACENTER)
str += TEXT(" DataCenter Server");
else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
str += TEXT(" Advanced Server");
else
str += TEXT(" Server");
} else if (osvi.wProductType == VER_NT_DOMAIN_CONTROLLER) {
str += TEXT(" Domain Controller");
}
} else {
TCHAR type[80];
DWORD dwBufLen;
HKEY hKey;
if (!RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\Control\\ProductOptions"), 0, KEY_QUERY_VALUE, &hKey)) {
RegQueryValueEx(hKey, TEXT("ProductType"), NULL, NULL, (LPBYTE)type, &dwBufLen);
RegCloseKey(hKey);
if (!_tcsicmp(TEXT("WINNT"), type))
str += TEXT(" Workstation");
else if (!_tcsicmp(TEXT("LANMANNT"), type))
str += TEXT(" Server");
else if (!_tcsicmp(TEXT("SERVERNT"), type))
str += TEXT(" Advanced Server");
}
}
break;
case VER_PLATFORM_WIN32_WINDOWS:
if (osvi.dwMajorVersion>4 ||
(osvi.dwMajorVersion==4 && osvi.dwMinorVersion>0)) {
if (osvi.dwMinorVersion == 90)
str = TEXT("Microsoft Windows ME");
else
str = TEXT("Microsoft Windows 98");
if (osvi.szCSDVersion[1] == 'A')
str += TEXT(" SE");
} else {
str = TEXT("Microsoft Windows 95");
if (osvi.szCSDVersion[1]=='B' || osvi.szCSDVersion[1]=='C')
str += TEXT(" OSR2");
}
break;
case VER_PLATFORM_WIN32s:
str = TEXT("Microsoft Win32s");
default:
return TEXT("???");
}
String vstr;
if (osvi.dwMajorVersion <= 4)
vstr.printf(TEXT(" Version %d.%d %s Build %d"),
osvi.dwMajorVersion, osvi.dwMinorVersion,
osvi.szCSDVersion, osvi.dwBuildNumber&0xFFFF);
else
vstr.printf(TEXT(" %s (Build %d)"), osvi.szCSDVersion, osvi.dwBuildNumber&0xFFFF);
return str + vstr;
}
typedef void (WINAPI*RUNDLLPROC)(HWND hwnd, HINSTANCE hinst, LPCTSTR cmdline, DWORD nCmdShow);
BOOL RunDLL(HWND hwnd, LPCTSTR dllname, LPCSTR procname, LPCTSTR cmdline, UINT nCmdShow)

View file

@ -895,6 +895,10 @@ protected:
#endif
// determine windows version string
String get_windows_version_str();
/// link dynamicly to functions by using GetModuleHandle() and GetProcAddress()
template<typename FCT> struct DynamicFct
{