Board index » delphi » WINDOWS 95 or Windows NT

WINDOWS 95 or Windows NT

Hi
Is it possible to determine what version of windows the machine thats
running my application is using
I need to know whether it Windows 95 or Windows NT

Is there a function that returns the operating system or something ?

--
--
Gareth Elliott
Senior Software Engineer

NiSoft (UK) Limited
Unit 8, 31 Ballynahinch Road, Carryduff, BELFAST BT8 8EH
Tel: +44 (0) 1232 814121, Fax: +44 (0) 1232 813962
email: gelli...@nisoft.co.uk
Internet: www.nisoft.co.uk

 

Re:WINDOWS 95 or Windows NT


Hello

Try: HELP from Delphi and find topic: Windows version. There is smth.
about it.
Function: GetVersionEx. You can faind more in Win32 help (from MS but
included in DElphi).

Bye.
Lukasz Zeligowski

Quote
Gareth Elliott wrote:

> Hi
> Is it possible to determine what version of windows the machine thats
> running my application is using
> I need to know whether it Windows 95 or Windows NT

> Is there a function that returns the operating system or something ?

> --
> --
> Gareth Elliott
> Senior Software Engineer

> NiSoft (UK) Limited
> Unit 8, 31 Ballynahinch Road, Carryduff, BELFAST BT8 8EH
> Tel: +44 (0) 1232 814121, Fax: +44 (0) 1232 813962
> email: gelli...@nisoft.co.uk
> Internet: www.nisoft.co.uk

--
------------------------------------------
Pozdrowienia znad Morza.
                         ukasz eligowski

 ----------------------------------------
| Nie odwiedzajcie mojej strony domowej. |
 ----------------------------------------

  genetics.vcf
< 1K Download

Re:WINDOWS 95 or Windows NT


GENETICS schrieb in Nachricht <379C16E8.214A6...@gd.home.pl>...

Quote
>Hello

>Try: HELP from Delphi and find topic: Windows version. There is smth.
>about it.
>Function: GetVersionEx. You can faind more in Win32 help (from MS but
>included in DElphi).

>Bye.
>Lukasz Zeligowski

>Gareth Elliott wrote:

>> Hi
>> Is it possible to determine what version of windows the machine thats
>> running my application is using
>> I need to know whether it Windows 95 or Windows NT

>> Is there a function that returns the operating system or something ?

>> --
>> --
>> Gareth Elliott
>> Senior Software Engineer

Quite right:
procedure GetOSVersion;
var MyInfo:TOSVERSIONINFO;
    Mess:string;
    VString:string;
begin
     FillChar(MyInfo,SizeOf(MyInfo),0);
     MyInfo.dwOSVersionInfoSize:=SizeOf(MyInfo);
     if not GetVersionEx(MyInfo) then begin
        Mess:='Error!';
     end else begin
        case MyInfo.dwPlatFormID of
             VER_PLATFORM_WIN32s:Mess:='Win32s under Windows 3.1';
             VER_PLATFORM_WIN32_WINDOWS:Mess:='Windows 9x';
             VER_PLATFORM_WIN32_NT:Mess:='Windows NT';
        else
            Mess:='unknown';
        end;
        VString:='['+IntToStr(MyInfo.dwMajorVersion);
        VString:=VString+'.'+IntToStr(MyInfo.dwMinorVersion);
        VString:=VString+'.'+IntToStr(MyInfo.dwBuildNumber);
        VString:=VString+']';
    end;
    ShowMessage(Mess+' '+VString);
end;

Re:WINDOWS 95 or Windows NT


In article <049F56710FD6D211B08D006097A4426B0D6436@orion>, Gareth
Elliott says...
Quote
> Hi
> Is it possible to determine what version of windows the machine thats
> running my application is using
> I need to know whether it Windows 95 or Windows NT

> Is there a function that returns the operating system or something ?

Add SysUtils in Uses.
You can than use:
Win32Platform
Win32MajorVersion
Win32MinorVersion
Win32BuildNumber
Win32CSDVersion

procedure Info;
var
  Info:String;
begin
 if Win32Platform=VER_PLATFORM_WIN32_NT then
  Info:='Windows NT '
 else
  Info:='Windows 95/98 ';
 Info:=Info+IntToStr(Win32MajorVersion)+'.'+IntToStr(Win32MinorVersion);
 Info:=Info+#13+#10+' Build('+IntToStr(Win32BuildNumber and $FFFF)+':';
 Info:=Info+Win32CSDVersion+')'+#13+#10+#13+#10;
 Application.MessageBox(PChar(Info),PChar(Caption),MB_ICONINFORMATION);
end;  
--
+--------------------------------+
  Rodiger Dejan,                
  dejan.virusrodi...@ck.tel.hr  
  Remove virus from e-mail      
+--------------------------------+

Re:WINDOWS 95 or Windows NT


Heres some code that should help

var
   sWinDir: String;
   sWinSub : String ;
begin
      sWinDir := '                                ' + #0;  // 32 spaces
or whatever
      GetWindowsDirectory(@sWinDir[1], 32);
      sWinDir := Trim(sWinDir);
end;

Here's something you may want to add too if you want who logged in...
   sCurrentUser  := '                ' + #0; // 16 spaces
   WNetGetUser('', @sCurrentUser[1], 16);
   sCurrentUser = Trim(sCurrentUser)

Hope it helps

Tom

Quote
Gareth Elliott wrote:
> Hi
> Is it possible to determine what version of windows the machine thats
> running my application is using
> I need to know whether it Windows 95 or Windows NT

> Is there a function that returns the operating system or something ?

> --
> --
> Gareth Elliott
> Senior Software Engineer

> NiSoft (UK) Limited
> Unit 8, 31 Ballynahinch Road, Carryduff, BELFAST BT8 8EH
> Tel: +44 (0) 1232 814121, Fax: +44 (0) 1232 813962
> email: gelli...@nisoft.co.uk
> Internet: www.nisoft.co.uk

Re:WINDOWS 95 or Windows NT


I suppose I should've also said that you could then search the string for
the presence of WINNT to determine if NT, otherwise its winxx.  Also
something useful for copying dlls to the system directory is the
GetSystemDirectory, same params I believe...

Tom

Quote
Tom wrote:
> Heres some code that should help

> var
>    sWinDir: String;
>    sWinSub : String ;
> begin
>       sWinDir := '                                ' + #0;  // 32 spaces
> or whatever
>       GetWindowsDirectory(@sWinDir[1], 32);
>       sWinDir := Trim(sWinDir);
> end;

> Here's something you may want to add too if you want who logged in...
>    sCurrentUser  := '                ' + #0; // 16 spaces
>    WNetGetUser('', @sCurrentUser[1], 16);
>    sCurrentUser = Trim(sCurrentUser)

> Hope it helps

> Tom

> Gareth Elliott wrote:

> > Hi
> > Is it possible to determine what version of windows the machine thats
> > running my application is using
> > I need to know whether it Windows 95 or Windows NT

> > Is there a function that returns the operating system or something ?

> > --
> > --
> > Gareth Elliott
> > Senior Software Engineer

> > NiSoft (UK) Limited
> > Unit 8, 31 Ballynahinch Road, Carryduff, BELFAST BT8 8EH
> > Tel: +44 (0) 1232 814121, Fax: +44 (0) 1232 813962
> > email: gelli...@nisoft.co.uk
> > Internet: www.nisoft.co.uk

Re:WINDOWS 95 or Windows NT


For getting the user name, it did not work with me ?
This does work :

function ggGetUserName: String;
var
  Buffer   : string;
  BuffSize : DWORD;
begin
  BuffSize := 128;
  SetLength(Buffer, BuffSize);
  GetUserName(PChar(Buffer), BuffSize);
  Result := Buffer;
end;

Quote
Tom wrote:
> I suppose I should've also said that you could then search the string for
> the presence of WINNT to determine if NT, otherwise its winxx.  Also
> something useful for copying dlls to the system directory is the
> GetSystemDirectory, same params I believe...

> Tom

> Tom wrote:

> > Heres some code that should help

> > var
> >    sWinDir: String;
> >    sWinSub : String ;
> > begin
> >       sWinDir := '                                ' + #0;  // 32 spaces
> > or whatever
> >       GetWindowsDirectory(@sWinDir[1], 32);
> >       sWinDir := Trim(sWinDir);
> > end;

> > Here's something you may want to add too if you want who logged in...
> >    sCurrentUser  := '                ' + #0; // 16 spaces
> >    WNetGetUser('', @sCurrentUser[1], 16);
> >    sCurrentUser = Trim(sCurrentUser)

> > Hope it helps

> > Tom

> > Gareth Elliott wrote:

> > > Hi
> > > Is it possible to determine what version of windows the machine thats
> > > running my application is using
> > > I need to know whether it Windows 95 or Windows NT

> > > Is there a function that returns the operating system or something ?

> > > --
> > > --
> > > Gareth Elliott
> > > Senior Software Engineer

> > > NiSoft (UK) Limited
> > > Unit 8, 31 Ballynahinch Road, Carryduff, BELFAST BT8 8EH
> > > Tel: +44 (0) 1232 814121, Fax: +44 (0) 1232 813962
> > > email: gelli...@nisoft.co.uk
> > > Internet: www.nisoft.co.uk

  gge.vcf
< 1K Download

Re:WINDOWS 95 or Windows NT


For getting the user name, it did not work with me ?
This does work :

function ggGetUserName: String;
var
  Buffer   : string;
  BuffSize : DWORD;
begin
  BuffSize := 128;
  SetLength(Buffer, BuffSize);
  GetUserName(PChar(Buffer), BuffSize);
  Result := Buffer;
end;

Quote
Tom wrote:
> I suppose I should've also said that you could then search the string for
> the presence of WINNT to determine if NT, otherwise its winxx.  Also
> something useful for copying dlls to the system directory is the
> GetSystemDirectory, same params I believe...

> Tom

> Tom wrote:

> > Heres some code that should help

> > var
> >    sWinDir: String;
> >    sWinSub : String ;
> > begin
> >       sWinDir := '                                ' + #0;  // 32 spaces
> > or whatever
> >       GetWindowsDirectory(@sWinDir[1], 32);
> >       sWinDir := Trim(sWinDir);
> > end;

> > Here's something you may want to add too if you want who logged in...
> >    sCurrentUser  := '                ' + #0; // 16 spaces
> >    WNetGetUser('', @sCurrentUser[1], 16);
> >    sCurrentUser = Trim(sCurrentUser)

> > Hope it helps

> > Tom

> > Gareth Elliott wrote:

> > > Hi
> > > Is it possible to determine what version of windows the machine thats
> > > running my application is using
> > > I need to know whether it Windows 95 or Windows NT

> > > Is there a function that returns the operating system or something ?

> > > --
> > > --
> > > Gareth Elliott
> > > Senior Software Engineer

> > > NiSoft (UK) Limited
> > > Unit 8, 31 Ballynahinch Road, Carryduff, BELFAST BT8 8EH
> > > Tel: +44 (0) 1232 814121, Fax: +44 (0) 1232 813962
> > > email: gelli...@nisoft.co.uk
> > > Internet: www.nisoft.co.uk

  gge.vcf
< 1K Download

Re:WINDOWS 95 or Windows NT


For getting the user name, it did not work with me ?
This does work :

function ggGetUserName: String;
var
  Buffer   : string;
  BuffSize : DWORD;
begin
  BuffSize := 128;
  SetLength(Buffer, BuffSize);
  GetUserName(PChar(Buffer), BuffSize);
  Result := Buffer;
end;

Quote
Tom wrote:
> I suppose I should've also said that you could then search the string for
> the presence of WINNT to determine if NT, otherwise its winxx.  Also
> something useful for copying dlls to the system directory is the
> GetSystemDirectory, same params I believe...

> Tom

> Tom wrote:

> > Heres some code that should help

> > var
> >    sWinDir: String;
> >    sWinSub : String ;
> > begin
> >       sWinDir := '                                ' + #0;  // 32 spaces
> > or whatever
> >       GetWindowsDirectory(@sWinDir[1], 32);
> >       sWinDir := Trim(sWinDir);
> > end;

> > Here's something you may want to add too if you want who logged in...
> >    sCurrentUser  := '                ' + #0; // 16 spaces
> >    WNetGetUser('', @sCurrentUser[1], 16);
> >    sCurrentUser = Trim(sCurrentUser)

> > Hope it helps

> > Tom

> > Gareth Elliott wrote:

> > > Hi
> > > Is it possible to determine what version of windows the machine thats
> > > running my application is using
> > > I need to know whether it Windows 95 or Windows NT

> > > Is there a function that returns the operating system or something ?

> > > --
> > > --
> > > Gareth Elliott
> > > Senior Software Engineer

> > > NiSoft (UK) Limited
> > > Unit 8, 31 Ballynahinch Road, Carryduff, BELFAST BT8 8EH
> > > Tel: +44 (0) 1232 814121, Fax: +44 (0) 1232 813962
> > > email: gelli...@nisoft.co.uk
> > > Internet: www.nisoft.co.uk

  gge.vcf
< 1K Download

Re:WINDOWS 95 or Windows NT


Thanks for this Guido, it works a treat. I was going to post this
question today, but you supplied the answer. Cheers.

In article <37B3C004.75269...@adtechno.be>, Guido Geurts
<g...@adtechno.be> writes

Quote
>For getting the user name, it did not work with me ?
>This does work :

>function ggGetUserName: String;
>var
>  Buffer   : string;
>  BuffSize : DWORD;
>begin
>  BuffSize := 128;
>  SetLength(Buffer, BuffSize);
>  GetUserName(PChar(Buffer), BuffSize);
>  Result := Buffer;
>end;

>Tom wrote:

>> I suppose I should've also said that you could then search the string for
>> the presence of WINNT to determine if NT, otherwise its winxx.  Also
>> something useful for copying dlls to the system directory is the
>> GetSystemDirectory, same params I believe...

>> Tom

>> Tom wrote:

>> > Heres some code that should help

>> > var
>> >    sWinDir: String;
>> >    sWinSub : String ;
>> > begin
>> >       sWinDir := '                                ' + #0;  // 32 spaces
>> > or whatever
>> >       GetWindowsDirectory(@sWinDir[1], 32);
>> >       sWinDir := Trim(sWinDir);
>> > end;

>> > Here's something you may want to add too if you want who logged in...
>> >    sCurrentUser  := '                ' + #0; // 16 spaces
>> >    WNetGetUser('', @sCurrentUser[1], 16);
>> >    sCurrentUser = Trim(sCurrentUser)

>> > Hope it helps

>> > Tom

>> > Gareth Elliott wrote:

>> > > Hi
>> > > Is it possible to determine what version of windows the machine thats
>> > > running my application is using
>> > > I need to know whether it Windows 95 or Windows NT

>> > > Is there a function that returns the operating system or something ?

>> > > --
>> > > --
>> > > Gareth Elliott
>> > > Senior Software Engineer

>> > > NiSoft (UK) Limited
>> > > Unit 8, 31 Ballynahinch Road, Carryduff, BELFAST BT8 8EH
>> > > Tel: +44 (0) 1232 814121, Fax: +44 (0) 1232 813962
>> > > email: gelli...@nisoft.co.uk
>> > > Internet: www.nisoft.co.uk

>[ A MIME text / x-vcard part was included here. ]

--
Peter Graham

Other Threads