msi.h (msi.h)

MsiGetShortcutTarget 函数检查快捷方式,并返回其产品、功能名称和组件(如果可用)。

语法

UINT MsiGetShortcutTargetA(
  [in]  LPCSTR szShortcutPath,
  [out] LPSTR  szProductCode,
  [out] LPSTR  szFeatureId,
  [out] LPSTR  szComponentCode
);

parameters

[in] szShortcutPath

一个以 null 结尾的字符串,用于指定快捷方式的完整路径。

[out] szProductCode

快捷方式的产品代码的 GUID。 此字符串缓冲区的长度必须为 39 个字符。 前 38 个字符用于 GUID,最后一个字符用于终止 null 字符。 此参数可以为 null。

[out] szFeatureId

快捷方式的功能名称。 字符串缓冲区的长度必须为 MAX_FEATURE_CHARS+1 个字符。 此参数可以为 null。

[out] szComponentCode

组件代码的 GUID。 此字符串缓冲区的长度必须为 39 个字符。 前 38 个字符用于 GUID,最后一个字符用于终止 null 字符。 此参数可以为 null。

返回值

此函数返回 UINT。

注解

如果函数失败,并且快捷方式存在,则可以通过 IShellLink 接口访问快捷方式的常规内容。

否则,可以使用 安装程序选择函数来确定目标的状态。

注意

msi.h 标头将 MsiGetShortcutTarget 定义为别名,该别名根据 UNICODE 预处理器常量的定义自动选择此函数的 ANSI 或 Unicode 版本。 将非特定编码别名的使用与非非特定编码的代码混合使用可能会导致不匹配,从而导致编译或运行时错误。 有关详细信息,请参阅 函数原型的约定

要求

   
最低受支持的客户端 Windows Server 2012、Windows 8、Windows Server 2008 R2 或 Windows 7 上的 Windows Installer 5.0。 Windows Server 2008 或 Windows Vista 上的 Windows Installer 4.0 或 Windows Installer 4.5。 Windows Server 2003 或 Windows XP 上的 Windows Installer。 若要了解 Windows Installer 版本所需的最低 Windows Service Pack,请参阅 Windows Installer 运行时要求。
目标平台 Windows
标头 msi.h
Library Msi.lib
DLL Msi.dll