DaveO
12/12/2011 2:27:00 PM
I hope this is just for personal use.
I HATE programs that insist on running on boot up. Windows boots to the
desktop quite quickly and then is unusable sometimes for minutes as a host
of programs each knowing they are more important than any other program hog
the resources phoning home or checking this or that which I invariably don't
want done but these programs seldom provide the option to prevent or delay
the run at boot up. After all each one is the greatest program ever and
nobody would ever need to stop it doing everything. (Yes Macromedia and
Adobe, I'm referring to you!)
What I thinkWindows needs is some kind of start up scheduler which will only
allow boot up processes to run sequentially rather than simultaneously.
Regards
DaveO
"BeeJ" <nospam@spamnot.com> wrote in message
news:jc3g84$7ge$1@speranza.aioe.org...
> My little backup app needs to start and run if windows is booted.
>
> I am trying the following code to create a startup shortcut in the auto
> start folder.
>
> But I need to let my app know that it is being auto started perhaps with a
> command line argument.
>
> Not sure how to do this such that if I double click the app it starts but
> does not run but if auto started it starts and runs.
>
> NOTE TO SELF: FIX DECLARATION LOCATION
> Public oShell As Shell32.Shell
> Public sPath As String
> Public sStartup As String
> Public sShellPath As String
>
> Private Sub Form_Load()
>
> ' CODE IS HERE JUST FOR DEVELOPMENT
> Set oShell = New Shell32.Shell
> AutoStartShortcutMake
>
> End Sub
>
> Public Sub AutoStartShortcutMake()
>
> With Shell.NameSpace(ssfPERSONAL).Self
> sPath = App.Path & "\" & App.EXEName & ".exe"
> End With
>
> ' REVISE TO CHECK FOR FOLDER AND AVOID ERROR CODE
> On Error Resume Next
> MkDir sPath
> Debug.Print Err.Description
> On Error GoTo 0
>
> With Shell.NameSpace(ssfSTARTUP).Self
> sStartup = .Path & "\" & App.EXEName & ".lnk"
> End With
>
> With Shell.NameSpace(ssfSYSTEM).Self
> sShellPath = .Path & "\Shell32.dll"
> End With
>
> ShortcutCreate sPath, _
> sStartup, _
> "Start " & App.EXEName, _
> sShellPath, _
> 24
>
> End Sub 'AutoStartShortcutMake
>
> Private Sub ShortcutCreate( _
> ByVal sItemPath As String, _
> ByVal sLinkPath As String, _
> ByVal sDescription As String, _
> ByVal sIconPath As String, _
> ByVal lIconNumber As Long)
>
> Dim lFNbr As Long
>
> lFNbr = FreeFile(0)
> Open sLinkPath For Output As #lFNbr
> Close #lFNbr
>
> With Shell.NameSpace(ssfDESKTOP).ParseName(LinkPath).GetLink
> .Path = sItemPath
> .Description = sDescription
> .SetIconLocation sIconPath, lIconNumber
> .Save
> End With
>
> End Sub 'ShortcutCreate
>
>