![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Feb 2005
Posts: 18
Rep Power: 0
![]() |
i need an application to create a shortcut to itself
Hi, ive made an application and I want it to create a shortcut to itself in the start menu's startup folder so it will run on startup. he filename of the app will be the same as it will be compiled as an exe. e.g. if the file was in c:/downloads/app.exe, then a shortcut would be made pointing to c:/downloads/app.exe, but say it was in c:/program files/other folders/downloads/app.exe then the shortcut would point there. I have found a method of creating a shortcut to a defined location but as the app will be in different directories on different machines, this wont work. all i need is a way of entering in the apps own location. ive tried this so far
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 Dim lReturn As Long obviously this part is under an event lReturn = fCreateShellLink("\Startup", "title of app", _ "\appname.exe", "") this just points the shortcut to the c:/appname.exe thanks |
|
|
|
|
|
#2 |
|
Expert Programmer
|
Well, if you add this function somewhere:
' Ensures hString ends in hSuffix
Public Function eSuffix(ByVal hString As String, ByVal hSuffix As String) As String
If StrComp(Right(hString, Len(hSuffix)), hSuffix, vbTextCompare) Then
eSuffix = hString & hSuffix
Else
eSuffix = hString
End If
End FunctionThen the containing folder of the application is guaranteed to be: eSuffix(App.Path, "\") eSuffix(App.EXEName, ".exe") eSuffix(App.Path, "\") & eSuffix(App.EXEName, ".exe") How are you checking to see if the shortcut already exists? |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|