create xp shortcuts

I have coded in vb6 an installation program and it creates startmenu-programs and desktop shortcuts ok for win95 platform. BUT i also want it to handle winXP, it installs ok and edits registry ok but i need
some example code or AN ANSWER on how to create shortcuts for winXP. Geez a list of whats called
SPECIAL FOLDERS for the SHELL call would be nice....is there any expert that is spiritual enough to help me out please would be muchly appreciated...cheers
christo7777Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Tommy KinardCommented:
The below code was pickup from tha allapi network http://www.allapi.net/ the code was modified but will serve as a guide. The code works for W2K XP 98 98se 95 ME (tested). The only problem I have had was when I changed the icons for the ms-dos batch/exe files. If you need that let me know.


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
Private Declare Function GetVersionExA Lib "kernel32" (lpVersionInformation As OSVERSIONINFO) As Long

Private Type OSVERSIONINFO
    dwOSVersionInfoSize As Long
    dwMajorVersion As Long
    dwMinorVersion As Long
    dwBuildNumber As Long
    dwPlatformId As Long
    szCSDVersion As String * 128
End Type

Private Enum Enum_OperatingPlatform
  Platform_Windows_32 = 0
  Platform_Windows_95_98_ME = 1
  Platform_Windows_NT_2K_XP = 2
End Enum

Private Enum Enum_OperatingSystem
  System_Windows_32 = 0
  System_Windows_95 = 1
  System_Windows_98 = 2
  System_Windows_ME = 3
  System_Windows_NT = 4
  System_Windows_2K = 5
  System_Windows_XP = 6
End Enum
Private Sub CreateShortcut()
    Dim lngResult As Long
    Dim ThisDrive As String
    Dim MyWhere As String
    Dim OperSys As Integer '"..\..\Start Menu\Programs\"
    Select Case OperatingSystem
        Case System_Windows_32: OperSys = 0
        Case System_Windows_95: OperSys = 0
        Case System_Windows_98: OperSys = 0
        Case System_Windows_ME: OperSys = 0
        Case System_Windows_NT: OperSys = 0
        Case System_Windows_2K: OperSys = 1
        Case System_Windows_XP: OperSys = 2
    End Select
    MyWhere = "C:\Documents and settings\" & WhoYouAre
    If OperSys = 1 Then
        lngResult = fCreateShellLink("..\..\Desktop", "MyApp", "C:\Program files\MyApp\MyApp.exe", "")
    ElseIf OperSys = 2 Then
        lngResult = fCreateShellLink("..\..\Desktop", "MyApp", "C:\Program files\MyApp\MyApp.exe", "")
    Else
        lngResult = fCreateShellLink("..\..\Desktop", "MyApp", "C:\Program files\MyApp\MyApp.exe", "")
    End If
    If lngResult = 1 Then
        If OperSys = 1 Then
            Call CheckForDirectory(MyWhere & "\Start Menu\Programs\MyApp\")
            lngResult = fCreateShellLink("..\..\Start Menu\Programs\MyApp", "MyApp", "C:\Program files\MyApp\MyApp.exe", "")
        ElseIf OperSys = 2 Then
            Call CheckForDirectory(MyWhere & "\Start Menu\Programs\MyApp\")
            lngResult = fCreateShellLink("..\..\Start Menu\Programs\MyApp", "MyApp", "C:\Program files\MyApp\MyApp.exe", "")
        Else
            Call CheckForDirectory("C:\windows\Start Menu\Programs\MyApp\")
            lngResult = fCreateShellLink("..\..\Start Menu\Programs\MyApp", "MyApp", "C:\Program files\MyApp\MyApp.exe", "")
        End If
    End If
End Sub

Private Function OperatingSystem() As Enum_OperatingSystem
    Dim lpVersionInformation As OSVERSIONINFO
    lpVersionInformation.dwOSVersionInfoSize = Len(lpVersionInformation)
    Call GetVersionExA(lpVersionInformation)
    If (lpVersionInformation.dwPlatformId = Platform_Windows_32) Then
        OperatingSystem = System_Windows_32
    ElseIf (lpVersionInformation.dwPlatformId = Platform_Windows_95_98_ME) And (lpVersionInformation.dwMinorVersion = 0) Then
        OperatingSystem = System_Windows_95
    ElseIf (lpVersionInformation.dwPlatformId = Platform_Windows_95_98_ME) And (lpVersionInformation.dwMinorVersion = 10) Then
        OperatingSystem = System_Windows_98
    ElseIf (lpVersionInformation.dwPlatformId = Platform_Windows_95_98_ME) And (lpVersionInformation.dwMinorVersion = 90) Then
        OperatingSystem = System_Windows_ME
    ElseIf (lpVersionInformation.dwPlatformId = Platform_Windows_NT_2K_XP) And (lpVersionInformation.dwMajorVersion < 5) Then
        OperatingSystem = System_Windows_NT
    ElseIf (lpVersionInformation.dwPlatformId = Platform_Windows_NT_2K_XP) And (lpVersionInformation.dwMajorVersion = 5) And (lpVersionInformation.dwMinorVersion = 0) Then
        OperatingSystem = System_Windows_2K
    ElseIf (lpVersionInformation.dwPlatformId = Platform_Windows_NT_2K_XP) And (lpVersionInformation.dwMajorVersion = 5) And (lpVersionInformation.dwMinorVersion = 1) Then
        OperatingSystem = System_Windows_XP
    End If
End Function

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CleanupPingCommented:
christo7777:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.