[C#] 바로가기만들기

Programming/C++_C#|2019. 1. 15. 17:30
반응형

안녕하세요~

c# 에서 바로가기를 만드는 코드에 대해 알아보겠습니다.

 

 

 

 

1. c#프로젝트를 켜고 참조 - 참조추가를 눌러줍니다.

 

 

2. COM에서 Windows Script Host Object Model을 체크하고 확인을 누릅니다.

 

 

코드

using IWshRuntimeLibrary;

 

WshShell wshIns;

wshIns = new WshShell();


string path = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);  // 바탕화면경로


WshRuntimeLibrary.IWshShortcut     myShotCut;
myShotCut = (IWshRuntimeLibrary.IWshShortcut)wshIns.CreateShortcut(path + "/test바로가기.lnk");


myShotCut.TargetPath = @"C:\TestFolder\응용프로그램.exe";
myShotCut.Description = "shotcut test";
myShotCut.IconLocation = @"C:\TestFolder\아이콘.ico";
myShotCut.Save();

 

ffecf0

 

위와 같이 해주면 바탕화면에 해당 응용프로그램의 test바로가기 링크가 생깁니다.

감사합니다//ㅅ//

반응형

'Programming > C++_C#' 카테고리의 다른 글

[C#] c# 폴더 만들기  (0) 2019.01.17
[C#] c#에서 FTP연결 및 파일 받기  (0) 2019.01.17
[C#] Windows Form을 이용해 런처 만들기(0)  (0) 2019.01.09
[C++] 단일 재귀 함수 호출  (0) 2018.11.14
fopen wb쓰기 null 에러  (0) 2018.08.31

댓글()