FolderItem.IsLink 属性
指示该项是否为快捷方式。
此属性为只读。
语法
bIsLink = FolderItem.IsLink
属性值
如果项是快捷方式,则为 true 的布尔值;否则为 false。
示例
以下示例使用 IsLink 确定特定对象是否为链接。 在这种情况下, 对象是 Internet Explorer 的快捷方式,因此应返回 true。 显示 JScript、VBScript 和 Visual Basic 的正确用法。
Jscript:
<script language="JScript">
function fnIsLinkJ()
{
var objShell = new ActiveXObject("shell.application");
var objFolder2;
var ssfPROGRAMS = 2;
objFolder2 = objShell.NameSpace(ssfPROGRAMS);
if (objFolder2 != null)
{
var objFolderItem;
objFolderItem = objFolder2.ParseName("Internet Explorer.lnk");
if (objFolderItem != null)
{
var bReturn;
bReturn = objFolderItem.IsLink;
}
}
}
</script>
VBScript:
<script language="VBScript">
function fnIsLinkVB()
dim objShell
set objShell = CreateObject("shell.application")
if (not objShell is nothing) then
dim objFolder2
dim ssfPROGRAMS
ssfPROGRAMS = 2
set objFolder2 = objShell.NameSpace(ssfPROGRAMS)
if (not objFolder2 is nothing) then
dim objFolderItem
set objFolderItem = objFolder2.ParseName("Internet Explorer.lnk")
if (not objFolderItem is nothing) then
dim bReturn
bReturn = objFolderItem.IsLink
end if
set objFolderItem = nothing
end if
set objFolder2 = nothing
end if
set objShell = nothing
end function
</script>
Visual Basic:
Private Sub fnIsLinkVB()
Dim objShell As Shell
Dim objFolder2 As Folder2
Dim ssfPROGRAMS As Long
ssfPROGRAMS = 2
Set objShell = New Shell
Set objFolder2 = objShell.NameSpace(ssfPROGRAMS)
If (Not objFolder2 Is Nothing) Then
Dim objFolderItem As FolderItem
Set objFolderItem = objFolder2.ParseName("Internet Explorer.lnk")
If (Not objFolderItem Is Nothing) Then
Dim bReturn As Boolean
bReturn = objFolderItem.IsLink
Else
'FolderItem object returned nothing.
End If
Set objFolderItem = Nothing
Else
'Folder object returned nothing.
End If
Set objFolder2 = Nothing
Set objShell = Nothing
End Sub
要求
要求 | 值 |
---|---|
最低受支持的客户端 |
Windows 2000 专业版、Windows XP [仅限桌面应用] |
最低受支持的服务器 |
Windows 2000 Server [仅限桌面应用] |
标头 |
|
IDL |
|
DLL |
|