Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Startup shortcut

Posted on 1999-07-16
8
Medium Priority
?
577 Views
Last Modified: 2012-05-04
I need to add a link to my program in the StartUp folder for the current user.  I want to have this shortcut use a command line parameter of "/m".  I aslo want to delete this shortcut whenever I need to.  I want to do this only in my program and not in the setup program.  This also needs to work for Windows 95, 98, and NT 4.0 so I need to check for secruity permissions if it is NT.  I'll appreciate any help.  Thanks.
0
Comment
Question by:Ra
[X]
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
8 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1525456
check out the VB fCreateShellLink() function.... that'll do what you want...

..-=ViKtOr=-..
0
 

Author Comment

by:Ra
ID: 1525457
and where do I find this function to check it out???  It is definitly not in help.  I type it in and the VB compiler says sub or function not defined.  I need more info.
0
 

Expert Comment

by:EDDYK
ID: 1525458
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

Check the setup1 program that comes with VB
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Accepted Solution

by:
viktornet earned 800 total points
ID: 1525459
Ra, sorry,, i lost track of this question :)) Now as this guy added a comment I received e=mail... okay,..

Here is an example how to do it...


      Add a Command button (Command1) to Form1.

      .Add the following code to the General Declarations section of Form1:

                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
           



      Press the F5 key to run the project, and then click the Command button.


      NOTE: If you are running Windows NT, the above example works correctly. If
      you are running Windows 95 or Windows 98, change the Calc.exe path to the
      following:

         C:\Windows\Calc.exe

      This creates a shortcut to the Calc.exe file on the user's desktop, a program
      group, and a reference to it in the Startup items.

      ..-=ViKtOr=-..
0
 
LVL 2

Expert Comment

by:Plinio
ID: 1525460
in any languaje?
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1525461
Please grade!
0
 

Author Comment

by:Ra
ID: 1525462
Thanks viktornet, it works great.  I already found out how to find if it already exist and to delete it if necessary.

Sorry it took so long for me to respond, I've been very busy with projects at work.

Thanks a bunch.
0
 

Author Comment

by:Ra
ID: 1525463
Oh, one more thing.  I assume I can add something to the lpstrLinkArguments to make it start up minimized.  What do I need to do that?

Thanks again.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

670 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