RunAtStartUp – Run any application at startup, once or multiple times

' Add or remove a program to the list of applications that will' be automatically launched when Windows boots.'' Action can be:'      0 = delete from list'      1 = execute only once'     ELSE = execute always' APPTITLE is the name of the key in the system Registry, if omitted'  the current project's title will be used instead' APPPATH is the complete path+name of the program that must be launched'  if omitted the current application path is used'' TIP: you might use this routine inside the QueryUnload event, when' the Windows session is closing, so that you can save the current set of' data and run again the application in the same state when Windows restarts.'' NOTE: uses the SetRegistryValue and DeleteRegistryValue functionsSub RunAtStartUp(ByVal Action As Integer, Optional ByVal AppTitle As String, _    Optional ByVal AppPath As String)    ' This is the key under which you must register the apps    ' that must execute after every restart    Const HKEY_CURRENT_USER = &H80000001    Const REGKEY = "SoftwareMicrosoftWindowsCurrentVersionRun"    ' provide a default value for AppTitle    AppTitle = LTrim$(AppTitle)    If Len(AppTitle) = 0 Then AppTitle = App.Title        ' this is the complete application path    AppPath = LTrim$(AppPath)    If Len(AppPath) = 0 Then        ' if omitted, use the current application executable file        AppPath = App.Path & IIf(Right$(App.Path, 1) <> "", "", _            "") & App.EXEName & ".Exe"    End If    Select Case Action        Case 0            ' we must delete the key from the registry            DeleteRegistryValue HKEY_CURRENT_USER, REGKEY, AppTitle        Case 1            ' we must add a value under the ...RunOnce key            SetRegistryValue HKEY_CURRENT_USER, REGKEY & "Once", AppTitle, _                AppPath        Case Else            ' we must add a value under the ....Run key            SetRegistryValue HKEY_CURRENT_USER, REGKEY, AppTitle, AppPath    End SelectEnd Sub

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS