Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Comment Creer un raccourci
Message
 
To
24/02/1999 10:31:46
General information
Forum:
Visual Basic
Category:
Other
Miscellaneous
Thread ID:
00190946
Message ID:
00191358
Views:
15
Bonjour, voici un code source tiré du site http://www.visualbasic.org/vbfaq/advanced.htm
Creating a shortcut (a Shell Link) is rather easy with Visual Basic, because Microsoft created a simple API function in the setupkit DLL called fCreateShellLink. Deleting a Shell Link is even easier, because all that need be done is delete the correct .LNK file. Alas, changing a shortcut is
not directly available with Visual Basic because you must go through the Windows95 IShellLink interface to access the different parameters of a Shell Link.
To create a shell link, add the following code to the default form of a new project:

Private Declare Function fCreateShellLink Lib "STKIT432.DLL" (ByVal _
lpstrFolderName As String, ByVal lpstrLinkName As String, ByVal _
lpstrLinkPath As String, ByVal lpstrLinkArgs As String) As Long

Sub Command1_Click()

Dim lReturn As Long

'Add to Desktop
lReturn = fCreateShellLink("..\..\Desktop", _
"Shortcut to Calculator", "c:\windows\calc.exe", "")

'Add to Program Menu Group
lReturn = fCreateShellLink("", "Shortcut to Calculator", _
"c:\windows\calc.exe", "")

'Add to Startup Group
lReturn = fCreateShellLink("\Startup", "Shortcut to Calculator", _
"c:\windows\calc.exe", "")

End Sub
Note 1 : le programme d'installation de MS (setupwizard) crée un raccourci avec un code similaire. Le projet Setup.vbp contient ce code...
Note 2 : Sur ce forum il y a 95 % d'anglophones. Si vous souhaitez obtenir des réponses, formulez de préférences vos questions en anglais.

EEQCA (En Espérant Que Ca Aide)
VB Developer
Servilog Concept
jmb@octalfrance.com
Previous
Reply
Map
View

Click here to load this message in the networking platform