ShellLinkObject.GetIconLocation 메서드
링크에 할당된 아이콘의 위치를 가져옵니다.
구문
iRetVal = ShellLinkObject.GetIconLocation(
sPath
)
매개 변수
-
sPath [out]
-
형식: BSTR*
이 메서드가 반환되면 아이콘이 포함된 파일의 정규화된 경로를 보유합니다.
반환 값
형식: 정수*
sPath로 지정된 파일에서 아이콘의 인덱스를 반환합니다.
예제
다음 예제에서는 JScript, VBScript 및 Visual Basic에 대해 이 메서드를 적절하게 사용하는 방법을 보여 줍니다.
Jscript:
<script language="JScript">
function fnShellShellLinkObjectGetIconLocationJ()
{
var objShell = new ActiveXObject("shell.application");
var objFolder;
var ssfPROGRAMS = 2;
objFolder = objShell.NameSpace(ssfPROGRAMS);
if (objFolder != null)
{
var objFolderItem;
objFolderItem = objFolder.ParseName("Internet Explorer.lnk");
if (objFolderItem != null)
{
var objShellLink;
objShellLink = objFolderItem.GetLink;
if (objShellLink != null)
{
var nIcon;
nIcon = objShellLink.GetIconLocation(objFolderItem.Path);
alert(nIcon);
}
}
}
}
</script>
Vbscript:
<script language="VBScript">
function fnShellLinkObjectGetIconLocationVB()
dim objShell
dim objFolder
dim ssfPROGRAMS
ssfPROGRAMS = 2
set objShell = CreateObject("shell.application")
set objFolder = objShell.NameSpace(ssfPROGRAMS)
if (not objFolder is nothing) then
dim objFolderItem
set objFolderItem = objFolder.ParseName("Internet Explorer.lnk")
if (not objFolderItem is nothing) then
dim objShellLink
set objShellLink = objFolderItem.GetLink
if (not objShellLink is nothing) then
dim nIcon
nIcon = objShellLink.GetIconLocation(objFolderItem.Path)
alert(nIcon)
end if
set objShellLink = nothing
end if
set objFolderItem = nothing
end if
set objFolder = nothing
set objShell = nothing
end function
</script>
Visual Basic:
Private Sub fnShellLinkObjectGetIconLocationVB()
Dim objShell As Shell
Dim objFolder As Folder
Set objShell = New Shell
Set objFolder = objShell.NameSpace(ssfPROGRAMS)
If (Not objFolder Is Nothing) Then
Dim objFolderItem As FolderItem
Set objFolderItem = objFolder.ParseName("Internet Explorer.lnk")
If (Not objFolderItem Is Nothing) Then
Dim objShellLink As ShellLinkObject
Set objShellLink = objFolderItem.GetLink
If (Not objShellLink Is Nothing) Then
Dim nIcon As Integer
nIcon = objShellLink.GetIconLocation(objFolderItem.Path)
Debug.Print nIcon
End If
Set objShellLink = Nothing
End If
Set objFolderItem = Nothing
End If
Set objFolder = Nothing
Set objShell = Nothing
End Sub
요구 사항
요구 사항 | 값 |
---|---|
지원되는 최소 클라이언트 |
Windows 2000 Professional SP3 [데스크톱 앱만 해당] |
지원되는 최소 서버 |
Windows 2000 Server[데스크톱 앱만] |
헤더 |
|
IDL |
|
DLL |
|
추가 정보