1
我在Visual C#中使用DOTRAS库创建了一个代码,该程序在网络连接中创建pppoe拨号程序。但我无法弄清楚如何在桌面上创建拨号程序快捷方式。我一般知道如何在c#中创建应用程序快捷方式,但无法获取网络连接快捷方式代码。任何建议都是可观的。C#howto在桌面上创建网络拨号程序快捷方式
我在Visual C#中使用DOTRAS库创建了一个代码,该程序在网络连接中创建pppoe拨号程序。但我无法弄清楚如何在桌面上创建拨号程序快捷方式。我一般知道如何在c#中创建应用程序快捷方式,但无法获取网络连接快捷方式代码。任何建议都是可观的。C#howto在桌面上创建网络拨号程序快捷方式
这是最好的,我知道:
string destDir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
string destFileName = @"Connect To Example.lnk";
// Create .lnk file
string path = System.IO.Path.Combine(destDir, destFileName);
FileStream fs = File.Create(path);
fs.Close();
// Instantiate a ShellLinkObject that references the .lnk we created
Shell32.Shell shell = new Shell32.Shell();
Shell32.Folder shellFolder = shell.NameSpace(destDir);
Shell32.FolderItem shellFolderItem = shellFolder.Items().Item(destFileName);
Shell32.ShellLinkObject shellLinkObject = (Shell32.ShellLinkObject)shellFolderItem.GetLink;
// Set .lnk properties
shellLinkObject.Arguments = "-d Example";
shellLinkObject.Description = "Example Connection";
shellLinkObject.Path = @"%windir%\System32\rasphone.exe";
shellLinkObject.WorkingDirectory = "%windir%";
shellLinkObject.Save(path);
替换 “示例” 与您的连接名称
GR8。 使用一些mods,它工作正常,现在在当前用户的桌面上创建拨号程序快捷方式。如何为此桌面快捷方式添加任何ICON? 我也有用户名密码文本框在我的应用程序拨号连接。是否有任何方式,如果用户在框中输入用户名密码,他们应该保存到注册表中,下次应用程序加载时,它应该从注册表中获得ID传递? –
我不在我的电脑上。使用SetIconLocation – Dorad
好的,在我的C#WPF中,我拨号拨号特定的PPPoE拨号程序,如何添加检查此拨号程序是否已连接,如果是,则显示已连接的消息,否则继续连接它? –