Delphi에서 Windows 운영체제 버전 판단
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons;
type
TMainFrm = class(TForm)
edt1: TEdit;
lbl1: TLabel;
btn1: TBitBtn;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function GetWindowsVersionString: AnsiString;
function GetWindowsVersion: String;
end;
var
MainFrm: TMainFrm;
implementation
{$R *.dfm}
function TMainFrm.GetWindowsVersionString : AnsiString;
var
VI: TOSVersionInfoA;
begin
VI.dwOSVersionInfoSize := SizeOf(TOSVersioninfoA);
if GetVersionExA(VI) then
with VI do
Result := Trim (
Format(
'%d.%d build %d %s',
[dwMajorVersion, dwMinorVersion,dwBuildNumber,szCSDVersion]
)
)
else
Result:= '';
end;
procedure TMainFrm.btn1Click(Sender: TObject);
begin
edt1.Text := GetWindowsVersion;
end;
function TMainFrm.GetWindowsVersion : String;
var
AWin32Version : Extended;
OS: string;
begin
OS:= 'Windows ';
AWin32Version := StrToFloat(Format('%d.%d',[Win32MajorVersion, Win32MinorVersion]));
if Win32Platform = VER_PLATFORM_WIN32s then
Result := OS + '32'
else if Win32Platform = VER_PLATFORM_WIN32_WINDOWS then
begin
if AWin32Version = 4.0 then
Result := OS + '95'
else if AWin32Version = 4.1 then
Result := OS + '98'
else if AWin32Version = 4.9 then
Result := OS + 'Me'
else
Result := OS + '9X'
end
else if Win32Platform = VER_PLATFORM_WIN32_NT then
begin
if AWin32Version = 3.51 then
Result := OS + 'NT 3.51'
else if AWin32Version = 4.0 then
Result := OS + 'NT 4.0'
else if AWin32Version = 5.0 then
Result :=OS + '2000'
else if AWin32Version = 5.1 then
Result := OS + 'XP'
else if AWin32Version = 5.2 then
Result := OS + '2003'
else if AWin32Version = 6.0 then
Result:= OS +'Vista'
else if AWin32Version = 6.1 then
Result := OS + '7'
else if AWin32Version = 6.2 then
Result := OS + '8'
else
Result := OS + 'Other NT Kernal Windows';
end
else
Result := OS;
end;
end.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Bring application to foreground with a keypressFrom Forum Nokia Wiki Inorder to capture the keys while you application under background you've to override CCoeAppUi::H...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.