var
Form1: TForm1;
function GetOS :TOSVersion;
implementation
{$R *.DFM}
function GetOS;
var
OS :TOSVersionInfo;
begin
ZeroMemory(@OS,SizeOf(OS));
OS.dwOSVersionInfoSize:=SizeOf(OS);
GetVersionEx(OS);
Result:=osUnknown;
if OS.dwPlatformId=VER_PLATFORM_WIN32_NT then begin
case OS.dwMajorVersion of
3: Result:=osNT3;
4: Result:=osNT4;
5: Result:=os2K;
end;
if (OS.dwMajorVersion=5) and (OS.dwMinorVersion=1) then
Result:=osXP;
end else begin
if (OS.dwMajorVersion=4) and (OS.dwMinorVersion=0) then begin
Result:=os95;
if (Trim(OS.szCSDVersion)='B') then
Result:=os95OSR2;
end else
if (OS.dwMajorVersion=4) and (OS.dwMinorVersion=10) then begin
Result:=os98;
if (Trim(OS.szCSDVersion)='A') then
Result:=os98SE;
end else
if (OS.dwMajorVersion=4) and (OS.dwMinorVersion=90) then
Result:=osME;
end;
end;
안녕하세요!!! GetVersionEx 라는 API 함수를 사용하면 win95계열과 NT계열은 구분이 가능한데 좀더 세부적으로(95, 98, nt, 2000, xp) 구별 할 수 있는 방법이 있으면 알려 주세요!!! 꼭 부탁드립니다.......... 즐거운 하루 되세요^.^oO
홍성락
•
2003.01.24 20:10
예전에 '현재 사용중인 OS명 알아내기~'질문에 써넣은게 있는데요.
먼저 검색해보시지~
unit Unit1;
i...
먼저 검색해보시지~
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TOSVersion = (osUnknown, os95, os95OSR2, os98, os98SE, osNT3, osNT4, os2K, osME, osXP);
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
function GetOS :TOSVersion;
implementation
{$R *.DFM}
function GetOS;
var
OS :TOSVersionInfo;
begin
ZeroMemory(@OS,SizeOf(OS));
OS.dwOSVersionInfoSize:=SizeOf(OS);
GetVersionEx(OS);
Result:=osUnknown;
if OS.dwPlatformId=VER_PLATFORM_WIN32_NT then begin
case OS.dwMajorVersion of
3: Result:=osNT3;
4: Result:=osNT4;
5: Result:=os2K;
end;
if (OS.dwMajorVersion=5) and (OS.dwMinorVersion=1) then
Result:=osXP;
end else begin
if (OS.dwMajorVersion=4) and (OS.dwMinorVersion=0) then begin
Result:=os95;
if (Trim(OS.szCSDVersion)='B') then
Result:=os95OSR2;
end else
if (OS.dwMajorVersion=4) and (OS.dwMinorVersion=10) then begin
Result:=os98;
if (Trim(OS.szCSDVersion)='A') then
Result:=os98SE;
end else
if (OS.dwMajorVersion=4) and (OS.dwMinorVersion=90) then
Result:=osME;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
OSVersion :string;
begin
case GetOS of
os95, os95OSR2 : OSVersion:='Windows 95';
os98, os98SE : OSVersion:='Windows 98';
osME : OSVersion:='Windows Millenium Edition';
osNT3, osNT4 : OSVersion:='Windows NT';
os2K : OSVersion:='Windows 2000';
osXP : OSVersion:='Windows XP';
end;
showmessage(OSVersion);
end;
end.
hsr/////////////////////////////////////////////////