Did Delphi XE2 remove the IsWinNT function?

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


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.


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
  ...
链接地址: http://www.djcxy.com/p/59882.html

上一篇: 在Delphi XE2中使用泛型和前向声明时的编译器错误

下一篇: Delphi XE2是否删除了IsWinNT函数?