c# 创建快捷式 c# 创建快捷式

来源:百度知道 编辑:UC知道 时间:2024/06/18 04:20:12
怎样才能创建QQ登陆快捷式:
工具:c#.net

COM下Windows Script Host Object Model 这个dll
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using IWshRuntimeLibrary;

namespace TestCreateIcon
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
//创建快捷方式
//建立对象
WshShell shell = new WshShell();
//生成快捷方式文件,指定路径及文件名
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut("c:\\" + "my.lnk");
//快捷方式指向的目标
shortcut.TargetPath = "e:\\Serv-U.mdb";