View Single Post
Old Jul 8th, 2005, 8:33 PM   #2
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
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 Function

Then the containing folder of the application is guaranteed to be:
eSuffix(App.Path, "\")
The filename:
eSuffix(App.EXEName, ".exe")
And so the full path is obviously:
eSuffix(App.Path, "\") & eSuffix(App.EXEName, ".exe")

How are you checking to see if the shortcut already exists?
Rory is offline   Reply With Quote