Win32api.... can it create a Windows shortcut (.lnk) file?

Gaetan Corneau Gaetan_Corneau at baan.com
Thu Nov 11 09:17:04 EST 1999


Kevin,

There is a VB example:


      Option Explicit

      'NOTE: In Visual Basic 5.0, change Stkit432.dll in the following
      'statement to Vb5stkit.dll.

      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:\Winnt\system32\calc.exe", "")

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

        'Add to Startup Group

        'Note that on Windows NT, the shortcut will not actually appear
        'in the Startup group until your next reboot.
        lReturn = fCreateShellLink("\Startup", "Shortcut to Calculator", _
        "c:\Winnt\system32\calc.exe", "")

      End Sub

If you have NT 4, you should have Vb5stkit.dll already (I do, and I don't
have VB).
 
I think a better way with Python would be using the IShellLink COM
interface, but I have never used it.

Hope this helps,
______________________________________________________
   Gaetan Corneau
   Software Developer (Quality Assurance Team)
   BaaN  Supply Chain Solutions  
   E-mail: Gaetan_Corneau at baan.com        
   Compuserve: Gaetan_Corneau at compuserve.com  
   ICQ Number: 7395494             
   Tel: (418) 266-8252          
______________________________________________________
"Profanity is the one language all programmers know best"


> -----Original Message-----
> From: me [mailto:none at fake.net]
> Sent: Thursday, November 11, 1999 1:54 AM
> To: python-list at python.org
> Subject: Win32api.... can it create a Windows shortcut (.lnk) file?
> 
> 
> I'm just trying to find an easy to create shortcuts on 
> Windows platforms
> through Python... it doesn't seem to be a simple matter 
> though.  I've gone
> through all the Win32 docs, and found nothing, and have 
> started writing
> (with limited success) a C function to do it.
> 
> Is there an easy way?  q:]
> 
> Thanks,
> Kevin Cazabon
> kcazabon at home.com
> 
> 
> 
> -- 
> http://www.python.org/mailman/listinfo/python-list
> 




More information about the Python-list mailing list