Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Creating Items in Start Menu??

Posted on 2001-08-12
10
494 Views
Last Modified: 2013-11-14

Is there any way, either through API calls or another method to add items to the Start menu, create program groups, etc???   I've found some examples on how to "modify" an existing one, or create something in the previously used items folder and then copy that to the final destination, but I'm trying to create an installer program (similar to InstallShield) that will create the group and the shortcuts in the group programatically.   Where do I look to find out how to do this? (obviously it's possible since InstallShield and every other installer is doing it!!)
0
Comment
Question by:u42093
  • 5
  • 2
  • 2
  • +1
10 Comments
 
LVL 3

Expert Comment

by:andysalih
ID: 6378187
have a look at this

 
     This code enables you to create shortcuts on the desktop or startmenu or in the program file. This is especially useful when you need your setup program to create a program shorcut to the desktop which is not provided in the usual setup kit that ships with visual basic.

Windows API/Global Declarations:

Public Declare Function OSfCreateShellLink Lib "vb6stkit.dll" Alias "fCreateShellLink" _
    (ByVal lpstrFolderName As String, _
    ByVal lpstrLinkName As String, _
    ByVal lpstrLinkPath As String, _
    ByVal lpstrLinkArguments As String, _
    ByVal fPrivate As Long, _
    ByVal sParent As String) As Long


then download the this thread :-
http://www.planetsourcecode.com/xq/ASP/txtCodeId.8120/lngWId.1/qx/vb/scripts/ShowCode.htm


cheers
Andy
0
 
LVL 3

Expert Comment

by:andysalih
ID: 6378191
have a look at this :-

 
Creates a Windows Shortcut to a program executable, and places it on the Desktop, Start Menu, or a Start Menu subfolder.

http://www.planetsourcecode.com/xq/ASP/txtCodeId.869/lngWId.1/qx/vb/scripts/ShowCode.htm


cheers
Andy
0
 
LVL 3

Expert Comment

by:andysalih
ID: 6378199
and finally,

i think this is exactly what you require....

read on :-

Installation Program which uses cabfile-compression, creates shortcuts and folders and looks quite good - just like InstallShield ! If you ever wanted to code something like InstallShield (only a liitle bit less complex), you can start with this code. Inc

http://www.planetsourcecode.com/xq/ASP/txtCodeId.12819/lngWId.1/qx/vb/scripts/ShowCode.htm


download the code and change it to your choosing.

hope all of that helps

Andy
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 28

Accepted Solution

by:
Ark earned 200 total points
ID: 6378290
Hi

Const MAX_PATH = 260
' For "Calc.exe" only. If you know the path, you don't need this
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias _
"GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal _
nSize As Long) As Long


Private Sub Command1_Click()
   Dim WshShell As Object
   Dim oShellLink As Object
   Dim sStartMenu As String
   Dim sWindows As String
   Set WshShell = CreateObject("WScript.Shell")
   sStartMenu = WshShell.SpecialFolders("StartMenu")
   sWindows = GetWinPath
   Set oShellLink = WshShell.CreateShortcut(sStartMenu & "\Calculator.lnk")
   oShellLink.TargetPath = sWindows & "\calc.exe"
   oShellLink.WindowStyle = 1
   oShellLink.Hotkey = "CTRL+SHIFT+C"
   oShellLink.IconLocation = "calc.exe, 0"
   oShellLink.Description = "Shortcut for Calculator"
   oShellLink.WorkingDirectory = sWindows
   oShellLink.Save
   Set oShellLink = Nothing
   Set WshShell = Nothing
End Sub

' For "Calc.exe" only. If you know the path, you don't need this
Private Function GetWinPath() As String
    Dim strFolder As String
    Dim lngResult As Long
    strFolder = String(MAX_PATH, 0)
    lngResult = GetWindowsDirectory(strFolder, MAX_PATH)
    If lngResult <> 0 Then
       GetWinPath = Left(strFolder, InStr(strFolder, Chr(0)) - 1)
    Else
       GetWinPath = ""
    End If
End Function

Cheers
0
 
LVL 4

Expert Comment

by:wileecoy
ID: 6378356
Andysalih,

are you aware that it is in german or something?

wileecoy
0
 
LVL 3

Expert Comment

by:andysalih
ID: 6378387
no i didnt realise.

but whats the difference.

the questioner can always change the language in the msgbox to say what he wants it to say.


the code wont be written any different will it.

Andy
0
 
LVL 4

Expert Comment

by:wileecoy
ID: 6378434
No - the code won't be different unless any changes need to be made or it is being used in a non-German speaking country.... like here.... but if it will be needed in the format that it is currently in, and the users speak German, then it is just fine.... lol.
0
 
LVL 3

Expert Comment

by:andysalih
ID: 6378439
what you going on about,

if he's English, or Alien, as long has he can read the CODE and not the COMMENTS then he will be fine.

like i previously stated, he only has to change the message box langauge to his own.

geesh....

Andy
0
 

Author Comment

by:u42093
ID: 6426795

Yes it was all in German, but thanks to Babelfish and the fact that it follows InstallShield pretty closely, it was not too difficult to figure out.  No prob.

I'm also liking Ark's suggestion, too, though, since it doesn't rely on the presence of the DLL.  I'm trying both.    Originally, I didn't see Ark's response, so I went ahead an implemented the first solution.  I wish I could give both of you the points because they're both viable answers.
0
 

Author Comment

by:u42093
ID: 6426813

I like it!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question