我想顯示Windows版本和產品詳細信息的Vista操作系統使用GetProductInfo
函數在Delphi XE2由一個Senoir成員建議。我已經定義了下面的代碼,但我無法編譯它。我的代碼如下:Windows版本使用GetProductInfo
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.
我想我正在犯一些錯誤,但我無法找到它。請告訴我我犯錯的地方。
根本不會調用函數。 – 2013-03-26 18:35:05