Author: jerome
Date: 2009-09-02 16:43:41 +0200 (Wed, 02 Sep 2009)
New Revision: 5321

Added:
   
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/ComputerInfos.pas
Modified:
   
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Report.pas
Log:
* Added 'computerInfos' class that provide some information to put on the 
emails ( Os information, locale, ... ) Goal : improve mails visibility.

Added: 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/ComputerInfos.pas
===================================================================
--- 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/ComputerInfos.pas
                         (rev 0)
+++ 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/ComputerInfos.pas
 2009-09-02 14:43:41 UTC (rev 5321)
@@ -0,0 +1,90 @@
+unit ComputerInfos;
+
+interface
+
+uses
+  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
+  Dialogs, Grids, ExtCtrls, StdCtrls;
+
+  type TWinVersion = (
+                     wvUnknown,
+                     wvWin95,
+                     wvWin98,
+                     wvWin98SE,
+                     wvWinNT,
+                     wvWinME,
+                     wvWin2000,
+                     wvWinXP,
+                     wvWinVista
+                    );
+
+  function GetUserLanguage() : string;
+  function Time() : string;
+  function GetWinVersion(): TWinVersion;
+
+implementation
+
+
+{#### Return the user locale ####}
+function GetUserLanguage() : string;
+var
+  sz: Integer;
+begin
+  sz:= GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SNATIVELANGNAME, nil, 0);
+  SetLength(result, sz - 1);
+  GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SNATIVELANGNAME, Pchar(result), 
sz);
+end;
+
+
+{#### Return how many time the computer is running ####}
+function Time() : string;
+Begin
+  Result := IntToStr(Round((GetTickCount / 1000) / (24 * 3600))) ;
+End;
+
+
+function GetWinVersion(): TWinVersion;
+var
+   osVerInfo: TOSVersionInfo;
+   majorVersion, minorVersion: Integer;
+begin
+   Result := wvUnknown;
+   osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo) ;
+   if GetVersionEx(osVerInfo) then
+   begin
+     minorVersion := osVerInfo.dwMinorVersion;
+     majorVersion := osVerInfo.dwMajorVersion;
+     case osVerInfo.dwPlatformId of
+       VER_PLATFORM_WIN32_NT:
+       begin
+         if majorVersion <= 4 then
+           Result := wvWinNT
+         else if (majorVersion = 5) and (minorVersion = 0) then
+           Result := wvWin2000
+         else if (majorVersion = 5) and (minorVersion = 1) then
+           Result := wvWinXP
+         else if (majorVersion = 6) then
+           Result := wvWinVista;
+       end;
+       VER_PLATFORM_WIN32_WINDOWS:
+       begin
+         if (majorVersion = 4) and (minorVersion = 0) then
+           Result := wvWin95
+         else if (majorVersion = 4) and (minorVersion = 10) then
+         begin
+           if osVerInfo.szCSDVersion[1] = 'A' then
+             Result := wvWin98SE
+           else
+             Result := wvWin98;
+         end
+         else if (majorVersion = 4) and (minorVersion = 90) then
+           Result := wvWinME
+         else
+           Result := wvUnknown;
+       end;
+     end;
+   end;
+end;
+
+
+end.

Modified: 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Report.pas
===================================================================
--- 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Report.pas
        2009-09-02 10:08:17 UTC (rev 5320)
+++ 
software_suite_v3/software/tool/tool-second-installer/trunk/tool-second-installer/Report.pas
        2009-09-02 14:43:41 UTC (rev 5321)
@@ -27,7 +27,7 @@
    ShellAPI, Windows, TuxUtils, Dialogs, zLib, SysUtils, Controls, Classes,
    StdCtrls, ShlObj, Msinfo32Wrapper, KAZip, Forms, IdComponent, 
IdMessageCoder,
    IdMessageCoderMIME, IdBaseComponent, IdMessage, IdSMTP, IdIOHandler,
-   IdIOHandlerSocket, IdSSLOpenSSL, WinInet, IdHttp;
+   IdIOHandlerSocket, IdSSLOpenSSL, WinInet, IdHttp, ComputerInfos;
 
   {#### This object manage the Complete report creation ####}
 type
@@ -319,6 +319,7 @@
   IdSMTP1: TIdSMTP;
   IdMessage1: TIdMessage;
   body : TStringList;
+  osType : string;
 begin
 
   IdSMTP1 := TIdSMTP.Create(nil);
@@ -360,6 +361,28 @@
       end;
   end;
 
+  //Formating Quick vew computer informations.
+  body.Add(slinebreak + slinebreak + '************************* Error Infos 
*************************');
+
+  body.Add(slinebreak + slinebreak + '************************ ComputerInfos 
************************');
+
+  osType := 'Unknown';
+
+  case ComputerInfos.GetWinVersion() of
+    ComputerInfos.wvUnknown  : osType := 'Os not reconized';
+    ComputerInfos.wvWin98    : osType := 'Windows 98';
+    ComputerInfos.wvWin98SE  : osType := 'Windows 98 Se';
+    ComputerInfos.wvWinNT    : osType := 'Windows NT';
+    ComputerInfos.wvWinME    : osType := 'Windows Milenium';
+    ComputerInfos.wvWin2000  : osType := 'Windows 2000';
+    ComputerInfos.wvWinXP    : osType := 'Windows XP';
+    ComputerInfos.wvWinVista : osType := 'Windows Vista';
+  end;
+
+  body.Add(slinebreak + 'Windows version: ' + osType);
+  body.Add('User locale: ' + ComputerInfos.GetUserLanguage());
+  body.Add('Computer ran: ' + ComputerInfos.Time());
+
   IdMessage1.Body := body;
 
   try


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to