Know if your application is running in NT

 Function :

 

{$IFNDEF WIN32}

Const

   WF_WINNT    = $4000 ;

{$ENDIF}

Function IsNT : bool ;

{$IFDEF WIN32}

Var

   osv         : TOSVERSIONINFO ;

{$ENDIF}

Begin

   result := true ;

{$IFDEF WIN32}

   GetVersionEx ( osv ) ;

   If osv.dwPlatformId = VER_PLATFORM_WIN32_NT Then exit ;

{$ELSE}

   If ( ( GetWinFlags And WF_WINNT ) = WF_WINNT ) Then exit ;

{$ENDIF}

   result := false ;

End ;

 

 Example :

 

Procedure TForm1.Button1Click ( Sender : TObject ) ;

Begin

   If IsNt Then

      ShowMessage ( 'Running on NT .' )

   Else

      ShowMessage ( 'Not Running on NT .' )

End ;

 


BackHomeFoward