How to build an Internet shortcut in the program

xiaoxiao2021-03-06  20

the first method:

Add the following reference: COM Under Windows Script Host Object Model, then

Using system.Runtime.InteropServices; Using IWshruntimelibrary;

String mysite = "http://mysite.com"; string fav = system.environment.GetFolderPath (System.Environment.SpecialFolder.favorites) "//mysite.URL";

// Create a Windows Script Host Shell Class IWSHSHELL_CLASS WSHSHELL = New IWSHELL_CLASSCLASS ();

// Define shortcut file IWSHURLSHORTCUT SHORTCUT = shell.createshortcut (FAV) AS IWSHURLSHORTCUT; Shortcut.targetPath = mysite

/ / Save shortcut shortcut.save ();

Using system.Runtime.InteropServices; Using IWshruntimelibrary;

String mysite = "http://mysite.com"; string fav = system.environment.GetFolderPath (System.Environment.SpecialFolder.favorites) "//mysite.URL";

// Create a Windows Script Host Shell Class IWSHSHELL_CLASS WSHSHELL = New IWSHELL_CLASSCLASS ();

// Define shortcut file IWSHURLSHORTCUT SHORTCUT = shell.createshortcut (FAV) AS IWSHURLSHORTCUT; Shortcut.targetPath = mysite

/ / Save shortcut shortcut.save ();

Using system.Runtime.InteropServices; Using IWshruntimelibrary;

String mysite = "http://mysite.com"; string fav = system.environment.GetFolderPath (System.Environment.SpecialFolder.favorites) "//mysite.URL";

// Create a Windows Script Host Shell Class IWSHSHELL_CLASS WSHSHELL = New IWSHELL_CLASSCLASS ();

// Define shortcut file IWSHURLSHORTCUT SHORTCUT = shell.createshortcut (FAV) AS IWSHURLSHORTCUT; Shortcut.targetPath = mysite

/ / Save shortcut shortcut.save ();

The second method:

Create a text file, enter the following [InternetShortcut] URL = http://www.microsoft.com/ The suffix is ​​changed to ".url", you can.

转载请注明原文地址:https://www.9cbs.com/read-42600.html

New Post(0)