Question

Porting to XE2 and I've got a line IsWinNT that compiled in 7 and Delphi 2009 and never gave us any guff before.

I'm not sure what the purpose of such a function is, but was it removed or moved?

and what is a comparable function?


My bad, it was in Virtual Trees har. Sorry guys -1 for me. Free +1's on the house

Was it helpful?

Solution

In Delphi 2009, there is no IsWinNT function. In addition, there is no Windows API function named like that. Most likely you are confused: Perhaps IsWinNT was part of some 3rd-party library that you used?

Anyhow, if you are only targeting the Windows platform, then you can implement the function as

function IsWinNT: boolean;
begin
  result := true;
end;

since every Windows version since (and including) XP has been based on NT.

OTHER TIPS

I don't know such function, but you can use this code

if Win32Platform = VER_PLATFORM_WIN32_NT then 

FYI Delphi XE2 only runs on WinNT based systems

I can't find that function in any of my Delphi's (D6, D2010, DXE2). I would test for NT like this:

Win32Platform = VER_PLATFORM_WIN32_NT

This test is a little redundant on XE2 since it no longer supports targetting non-NT versions of Windows. I've not actually tried running an XE2 produced executable on Win9x lately so I don't know whether or not it fails when you do so.

In XE2 you can now make use of TOSVersion. For example, to check that you are running on Windows XP or up you would simply do:

if (TOSVersion.Platform=pfWindows) and (TOSVersion.Check(5, 1)) then
  ...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top