c# 바탕화면에 바로가기 아이콘 생성
COM 참조 추가
Windows Script Host Object Model
Namespace 추가
using IWshRuntimeLibrary;
public Form1()
{
InitializeComponent();
}
WshShell wsh;
private void button1_Click(object sender, EventArgs e)
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
wsh = new WshShell();
IWshRuntimeLibrary.IWshShortcut myShotCut;
myShotCut = (IWshRuntimeLibrary.IWshShortcut)wsh.CreateShortcut(path + "/test.lnk");
myShotCut.TargetPath = @"c:\reg\인명부자산프로그램.exe";
myShotCut.Description = "shotcut test";
myShotCut.IconLocation = @"c:\reg\assign.ico";
myShotCut.Save();
MessageBox.Show("완료");
}
//// 바로가기를 만든다.
//IWshRuntimeLibrary.IWshShortcut MyShortcut;
//// 바로가기를 저장할 경로를 지정한다.
//MyShortcut = (IWshRuntimeLibrary.IWshShortcut)WshShell.CreateShortcut(@"C:\MyShortcut.lnk");
//// 바로가기에 프로그램의 경로를 지정한다.
//MyShortcut.TargetPath = Application.ExecutablePath;
//// 바로가기의 description을 지정한다.
//MyShortcut.Description = "Launch My Application";
//// 바로가기 아이콘을 지정한다.
//MyShortcut.IconLocation = Application.StartupPath + @"\app.ico";
//// 바로가기를 저장한다.
//MyShortcut.Save();
'C# Study' 카테고리의 다른 글
C# SQL textbox binding - DataTable 이나 DataGridview 에 바인딩 없이 (0) | 2014.01.18 |
---|---|
c# 텍스트박스 엔터키로 명령 실행하기 (0) | 2013.12.19 |
c# 데이타셋 개념 DataSet, SqlDataAdapter, SqlConnection (0) | 2013.11.13 |
c# 데이터집합(dataset) (0) | 2013.10.20 |
c# 생성자 Reference Type, Value Type차이 Static 메소드 (0) | 2013.10.19 |