|
-
May 26th, 2005, 06:04 PM
#1
Thread Starter
Fanatic Member
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?
-
May 26th, 2005, 06:08 PM
#2
Re: program start up with all users
 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
-
May 26th, 2005, 06:09 PM
#3
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.
-
May 26th, 2005, 06:16 PM
#4
Thread Starter
Fanatic Member
Re: program start up with all users
VB Code:
so how bout this?
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
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
Const REG_SZ = 1
Const HKEY_CURRENT_USER = &H80000001
Const REGKEY = "Software\Microsoft\Windows\CurrentVersion\Run"
Const KEY_WRITE = &H20006
Dim Path As Long
Private Sub Form_Load()
If RegOpenKeyEx(HKEY_CURRENT_USER, REGKEY, 0, KEY_WRITE, Path) Then Exit Sub
Else
RegSetValueEx Path, App.Title, 0, REG_SZ, ByVal App.Path & "\" & App.EXEName & ".exe", Len(App.Path & "\" & App.EXEName & ".exe")
end sub
Last edited by dark_shadow; May 26th, 2005 at 06:21 PM.
-
May 26th, 2005, 06:22 PM
#5
Re: program start up with all users
If you want it for all users change HKEY_CURRENT_USER to HKEY_LOCAL_MACHINE
VB Code:
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|