Results 1 to 5 of 5

Thread: program start up with all users

  1. #1

    Thread Starter
    Fanatic Member dark_shadow's Avatar
    Join Date
    Feb 2005
    Location
    Igloo
    Posts
    900

    program start up with all users

    hi, i have a vb program that monitors the time users log in and off, i have it start up in the start up but it only starts up when my account logs in (windows saved my preferences) how can i have it start up using vb with all users?

  2. #2
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: program start up with all users

    Quote Originally Posted by dark_shadow
    hi, i have a vb program that monitors the time users log in and off, i have it start up in the start up but it only starts up when my account logs in (windows saved my preferences) how can i have it start up using vb with all users?
    2 Ways I can think of:

    1: Alter the registry and do it through there.
    2. Add a shortcut to your program in the All Users >> StartUp folder

    Cheers, Hope that helps

    RyanJ
    My Blog.

    Ryan Jones.

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: program start up with all users

    To alter the Registry add a string to this key:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

    You can name the string to whatever you like and it should contain the path to your application.

  4. #4

    Thread Starter
    Fanatic Member dark_shadow's Avatar
    Join Date
    Feb 2005
    Location
    Igloo
    Posts
    900

    Re: program start up with all users

    VB Code:
    1. so how bout this?
    2. Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
    3. Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
    4. Const REG_SZ = 1
    5. Const HKEY_CURRENT_USER = &H80000001
    6. Const REGKEY = "Software\Microsoft\Windows\CurrentVersion\Run"
    7. Const KEY_WRITE = &H20006
    8. Dim Path As Long
    9.  
    10. Private Sub Form_Load()
    11. If RegOpenKeyEx(HKEY_CURRENT_USER, REGKEY, 0, KEY_WRITE, Path) Then Exit Sub
    12. Else
    13.  RegSetValueEx Path, App.Title, 0, REG_SZ, ByVal App.Path & "\" & App.EXEName & ".exe", Len(App.Path & "\" & App.EXEName & ".exe")
    14. end sub
    Last edited by dark_shadow; May 26th, 2005 at 06:21 PM.

  5. #5
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: program start up with all users

    If you want it for all users change HKEY_CURRENT_USER to HKEY_LOCAL_MACHINE
    VB Code:
    1. Private Const HKEY_LOCAL_MACHINE As Long = &H80000002

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width