첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.

[VB] 단축 아이콘 만들기

VB 2015. 5. 16. 09:00
728x90
반응형
728x170

1. 프로젝트 / 참조 메뉴를 클릭한다.

 

2. 참조 대화 상자에서 "Windows Script Host Object Model" 항목을 선택한다.

 

728x90

 

3. 아래 코드를 추가한다.

Dim pShell      As IWshShell_Class
Dim pShortcut   As IWshShortcut_Class
Dim strItemType As String
Dim strPath     As String
Dim strFileName As String

Set pShell = New IWshShell_Class

strItemType = "Desktop"
'strItemType = "Program"
'strItemType = "MyDocuments"
'strItemType = "Favorites"
'strItemType = "Fonts"
'strItemType = "Recent"
'strItemType = "StartMenu"
'strItemType = "StartUp"

strPath = pShell.SpecialFolders.Item(strItemType)

strFileName = "test.lnk"

Set pShortcut = pShell.CreateShortcut(strPath & "\" & strFileName)

With pShortcut
    .TargetPath = "c:\windows\notepad.exe"
    .Description = "메모장"
    .Arguments = "" ' 필요시 인자를 지정할 수 있다.
    .WorkingDirectory = "c:\windows"
    .WindowStyle = 1
    .IconLocation = "c:\test.ico" ' 선택 항목이다.
    .Save
End With

Set pShortcut = Nothing

Set pShell = Nothing
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요