BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to detect VISTA

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi (General)
View previous topic :: View next topic  
Author Message
marios
Guest





PostPosted: Sun Feb 04, 2007 9:11 am    Post subject: How to detect VISTA Reply with quote



Hi ,

I have been using the follwoing code to detect if XP is running on a given
system.

I now need to detect VISTA . What is required to modify the code below.
I have no idea what to look for now? Google has been of no help.

Any suggestions would be greatly welcome

Marios
-------------------------------

function GetWinType(FName : PChar; W, H : integer ) : integer; stdcall;
var
OSVersion : TOSVersionInfo;
WinVersion: Integer;
begin
OSVersion.dwOSVersionInfoSize := sizeof(OSVersion);
GetVersionEx(OSVersion);
result :=0;
if OSVersion.dwPlatformId=VER_PLATFORM_WIN32_NT then
begin
if (OSVersion.dwMajorVersion >= 5) and (OSVersion.dwMinorVersion >= 1)
and (OSVersion.dwPlatformId = VER_PLATFORM_WIN32_NT) then
begin
result :=1 ;
end;
end;
end;
Back to top
Matt Lacey
Guest





PostPosted: Wed Feb 14, 2007 10:41 pm    Post subject: Re: How to detect VISTA Reply with quote



On 4 Feb, 03:55, "marios" <mar...@email.msn.com> wrote:
Quote:
Hi ,

I have been using the follwoing code to detect if XP is running on a given
system.

I now need to detect VISTA . What is required to modify the code below.
I have no idea what to look for now? Google has been of no help.

Any suggestions would be greatly welcome

Marios
-------------------------------

function GetWinType(FName : PChar; W, H : integer ) : integer; stdcall;
var
OSVersion : TOSVersionInfo;
WinVersion: Integer;
begin
OSVersion.dwOSVersionInfoSize := sizeof(OSVersion);
GetVersionEx(OSVersion);
result :=0;
if OSVersion.dwPlatformId=VER_PLATFORM_WIN32_NT then
begin
if (OSVersion.dwMajorVersion >= 5) and (OSVersion.dwMinorVersion >= 1)
and (OSVersion.dwPlatformId = VER_PLATFORM_WIN32_NT) then
begin
result :=1 ;
end;
end;
end;

Despite it's name, your function seems to return 1 if running on XP
and 0 if not.

To detect OS versions I use the constants Win32MajorVersion,
Win32MinorVersion and Win32Platform in SysUtils

Vista has a major version of 6.

Therefore:
function IsVista(): Boolean;
begin
result := Win32MajorVersion = 6;
end;

Disclaimer: This is not guaranteed to be accurate once LongHorn (or
any other new Microsoft operating system) comes out.
Back to top
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi (General) All times are GMT
Page 1 of 1

 
 


Powered by phpBB © 2001, 2006 phpBB Group
.