[DUG] Detecting environment

Alister Christie alister at SalesPartner.co.nz
Tue Feb 21 16:10:53 NZDT 2006


Yes the DebugHook is what I use (I don't know if it will work with .Net 
however - if that is an issue to you)

Version code:
unit GetWindowsVersion;

interface

uses windows, SysUtils;

type
     TWindowsVersion = record
        Windows: record
                    major: Byte;
                    minor: Byte;
                  end;
        DOS: record
               minor: Byte;
               major: Byte;
             end;
     end;

Function GetWindowsVersionRecord : TWindowsVersion;

implementation

Function GetWindowsVersionRecord : TWindowsVersion;
begin
    DWORD(Result) := GetVersion;
end;

end.

Usage:
   //Windows 2000 = 5.0 and XP = 5.1
   if GetWindowsVersionRecord.Windows.major >= 5 then
     PatchBDE;

Hope this of use,

Alister Christie
Computers for People
Ph: 04 471 1849 Fax: 04 471 1266
http://www.salespartner.co.nz
PO Box 13085
Johnsonville
Wellington


John Bird wrote:
> Delphi 2006:
> 
> What are the current easiest way to:
> 
> 1 - Detect if running in IDE? (google gives some complex code - I thought
> there was a simple way)
> 
> 	Best I have seen so far is:
> 	begin
> 	  if DebugHook<>0 then 
> 	    ShowMessage('Running in IDE');
> 	End;
> 
> 
> 2 - Get Windows Version - Still GetVersionEx?  (enough to know if Windows
> 95/98   or Windows 2000  or Windows XP)
> 
> John
> 
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
> 
> 


More information about the Delphi mailing list