我正在尝试按照GetProductInfo
一位高级成员的建议,使用 Delphi XE2 中的功能显示 Vista 及以上操作系统的 Windows 版本和产品详细信息。我已经定义了以下代码,但我无法编译它。我的代码如下:
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
type
TGetProductInfoAPI = function(dwOSMajorVersion, dwOSMinorVersion,
dwSpMajorVersion, dwSpMinorVersion: DWORD; pdwReturnedProductType:
PDWORD): BOOL stdcall;
begin
Edit1.Text:=IntToStr(dwOSMajorVersion);
Edit2.Text:=IntToStr(dwOSMinorVersion);
Edit3.Text:=IntToStr(dwSpMajorVersion);
Edit4.Text:=IntToStr(dwSpMinorVersion);
Edit5.Text:=TGetProductInfoAPI.pdwReturnedProductType;
end;
end.
我想我在做一些错误,但我找不到它。请告诉我我在哪里犯错。