最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
使用MSI读出本机已经安装软件列表
时间:2008-04-26 编辑:简简单单 来源:一聚教程网
type
PsoftItem = ^TSoftItem;
TSoftItem = packed record
SoftName: string;
SoftVer: string;
Path: string;
end;
procedure ReadLocalSoftByMSI(aList: TList);
var
Index: Integer;
Buf: array [0..38] of char;
PropBuf: PChar;
hr: UINT;
Len: DWORD;
P: PSoftItem;
begin
if not Assigned(aList) then exit;
for Index := aList.Count-1 downto 0 do
begin
P := aList.Items[Index];
if Assigned(P) then DisPose(P);
end;
aList.Clear;
Index := 0;
hr := MsiEnumProducts(Index, Buf);
while hr = ERROR_SUCCESS do
begin
new(P);
len := 0;
MsiGetProductInfo(Buf, INSTALLPROPERTY_INSTALLEDPRODUCTNAME, nil, @len);
Inc(Len);
PropBuf := AllocMem(len);
try
MsiGetProductInfo(Buf, INSTALLPROPERTY_INSTALLEDPRODUCTNAME, PropBuf, @len);
P^.SoftName := PropBuf;
finally
FreeMem(PropBuf);
end;
len := 0;
MsiGetProductInfo(Buf, INSTALLPROPERTY_INSTALLLOCATION, nil, @len);
Inc(Len);
PropBuf := AllocMem(len);
try
MsiGetProductInfo(Buf, INSTALLPROPERTY_INSTALLLOCATION, PropBuf, @len);
P^.Path := PropBuf;
finally
FreeMem(PropBuf);
end;
len := 0;
MsiGetProductInfo(Buf, INSTALLPROPERTY_VERSIONSTRING, nil, @len);
Inc(Len);
PropBuf := AllocMem(len);
try
MsiGetProductInfo(Buf, INSTALLPROPERTY_VERSIONSTRING, PropBuf,
-
上一个: 自绘效率曲线控件
相关文章
- C#复制数组的两种方式及效率比较解读 10-24
- ASP.NET Identity用法解析 10-24
- ASP.NET MVC使用Identity增删改查用户介绍 10-24
- C语言中atoi函数模拟实现介绍 10-18
- .Net反向代理组件Yarp用法介绍 10-10
- .NET使用YARP通过编码方式配置域名转发实现反向代理教程 10-10