|
-
Sep 7th, 2000, 08:09 AM
#1
Thread Starter
Junior Member
Folks,
I have created a VB tray app and want to install it so that it runs when the machine is started, however I don't want to use the startup folder.
(You know like the MSN Messenger App.)
Someone told me that you can use the registry to do this but didn't say how.
Any suggestions would be greatly appreciated.
Cheers
John
-
Sep 7th, 2000, 08:20 AM
#2
transcendental analytic
You can download my registry module on my homepage to access registry, this key contains the startup apps:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
Also you can put your startup app path in system.ini
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Sep 7th, 2000, 03:11 PM
#3
Here is an example:
Code:
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
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
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 Const HKEY_LOCAL_MACHINE = &H80000002
Private Const ERROR_SUCCESS = 0&
Private Const REG_SZ = 1
Private Const KEY_SET_VALUE = &H2
Public Function SetProgramStartup(pProgramName As String, pProgramPath As String) As Boolean
Dim lKeyHandle As Long
Dim lRet As Long
Dim strBuffer As String
Dim strKey As String
strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
lRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, strKey, 0, KEY_SET_VALUE, lKeyHandle)
If lRet = ERROR_SUCCESS Then
lRet = RegSetValueEx(lKeyHandle, pProgramName, 0, REG_SZ, ByVal pProgramPath, Len(pProgramPath))
RegCloseKey lKeyHandle
End If
End Function
Private Sub Command1_Click()
Call SetProgramStartup("MyProgram", "C:\MyProg.exe")
End Sub
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
|