 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Pepsiguy I post too much
Reputation: 0
Joined: 16 Aug 2007 Posts: 2016
|
Posted: Mon Feb 11, 2008 4:49 pm Post subject: Run on startup vb6 |
|
|
how do you make vb6 apps run on start up
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Mon Feb 11, 2008 4:58 pm Post subject: |
|
|
| startup folder, or from the registry
|
|
| Back to top |
|
 |
SkeleTron Grandmaster Cheater Supreme
Reputation: 1
Joined: 28 Jun 2007 Posts: 1022
|
|
| Back to top |
|
 |
Pepsiguy I post too much
Reputation: 0
Joined: 16 Aug 2007 Posts: 2016
|
Posted: Mon Feb 11, 2008 5:05 pm Post subject: |
|
|
in vb6, meaning, you click a button and it runs onstartup
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Mon Feb 11, 2008 5:08 pm Post subject: |
|
|
| slovach wrote: | | startup folder, or from the registry |
|
|
| Back to top |
|
 |
Pepsiguy I post too much
Reputation: 0
Joined: 16 Aug 2007 Posts: 2016
|
Posted: Mon Feb 11, 2008 5:09 pm Post subject: |
|
|
i bet you dont know how to do that, *me too*
_________________
|
|
| Back to top |
|
 |
SkeleTron Grandmaster Cheater Supreme
Reputation: 1
Joined: 28 Jun 2007 Posts: 1022
|
Posted: Mon Feb 11, 2008 5:10 pm Post subject: |
|
|
Use these functions:
SaveSetting(AppName, Section, Key, Setting)
GetSetting(AppName, Section, Key, Setting)
This explains it good: http://www.devx.com/vb2themax/Tip/19171
_________________
Reedemer.
Last edited by SkeleTron on Mon Feb 11, 2008 5:13 pm; edited 1 time in total |
|
| Back to top |
|
 |
Pepsiguy I post too much
Reputation: 0
Joined: 16 Aug 2007 Posts: 2016
|
Posted: Mon Feb 11, 2008 5:11 pm Post subject: |
|
|
so basically it saves the settings and then gets them back on startup?>??
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Mon Feb 11, 2008 5:14 pm Post subject: |
|
|
| pepsiguy_2 wrote: | | i bet you dont know how to do that, *me too* |
i just said how to do it, twice.
just create a shortcut to it in the startup folder, or create a key at: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
and no merely placing a key here isn't going to magically save all your program settings, that's up to you to do.
|
|
| Back to top |
|
 |
XxOsirisxX Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Oct 2006 Posts: 1597
|
Posted: Mon Feb 11, 2008 6:45 pm Post subject: |
|
|
| slovach wrote: | | pepsiguy_2 wrote: | | i bet you dont know how to do that, *me too* |
i just said how to do it, twice.
just create a shortcut to it in the startup folder, or create a key at: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
and no merely placing a key here isn't going to magically save all your program settings, that's up to you to do. |
Indeed.
Then, make a new String key, and put the value with the location of VB 6.0 / Net w.e
_________________
|
|
| Back to top |
|
 |
VBChar How do I cheat?
Reputation: 0
Joined: 11 Feb 2008 Posts: 3
|
Posted: Mon Feb 11, 2008 7:15 pm Post subject: |
|
|
For programs where I let the user decide if they want to run the program at start up I add a checkbox called Start_Up and this code.
| Code: |
Option Explicit
Private Sub Form_Load()
If WillRunAtStartup(App.EXEName) Then
Start_Up.Value = 1
Else
Start_Up.Value = 0
End If
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Dim SwW As Boolean
If Start_Up.Value = 1 Then
SwW = True
Else
SwW = False
End If
SetRunAtStartup App.EXEName, App.Path, SwW
End Sub
|
Put that in a Form
| Code: |
Option Explicit
Private Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, ByVal lpSecurityAttributes As Long, phkResult As Long, lpdwDisposition 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 Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey 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
Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
Private Const READ_CONTROL As Long = &H20000
Private Const KEY_SET_VALUE As Long = &H2
Private Const KEY_CREATE_SUB_KEY As Long = &H4
Private Const STANDARD_RIGHTS_WRITE As Long = (READ_CONTROL)
Private Const SYNCHRONIZE As Long = &H100000
Private Const KEY_WRITE As Long = ((STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY) And (Not SYNCHRONIZE))
Private Const STANDARD_RIGHTS_READ As Long = (READ_CONTROL)
Private Const KEY_ENUMERATE_SUB_KEYS As Long = &H8
Private Const KEY_NOTIFY As Long = &H10
Private Const KEY_QUERY_VALUE As Long = &H1
Private Const KEY_READ As Long = ((STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And (Not SYNCHRONIZE))
Private Const ERROR_SUCCESS As Long = 0&
Private Const HKEY_CURRENT_USER As Long = &H80000001
Private Const REG_SZ As Long = 1
Public Function WillRunAtStartup(ByVal App_Name As String) As Boolean
Dim hKey As Long
Dim value_type As Long
If RegOpenKeyEx(HKEY_CURRENT_USER, _
"Software\Microsoft\Windows\CurrentVersion\Run", _
0, KEY_READ, hKey) = ERROR_SUCCESS _
Then
WillRunAtStartup = _
(RegQueryValueEx(hKey, App_Name, _
ByVal 0&, value_type, ByVal 0&, ByVal 0&) = _
ERROR_SUCCESS)
RegCloseKey hKey
Else
WillRunAtStartup = False
End If
End Function
Public Sub SetRunAtStartup(ByVal App_Name As String, ByVal app_path As String, Optional ByVal run_at_startup As Boolean = True)
Dim hKey As Long
Dim key_value As String
Dim status As Long
On Error GoTo SetStartupError
If RegCreateKeyEx(HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Run", ByVal 0&, ByVal 0&, ByVal 0&, KEY_WRITE, ByVal 0&, hKey, ByVal 0&) <> ERROR_SUCCESS Then
MsgBox "Error " & Err.Number & " opening key" & vbCrLf & Err.Description
Exit Sub
End If
If run_at_startup Then
key_value = app_path & "\" & App_Name & ".exe" & vbNullChar
status = RegSetValueEx(hKey, App.EXEName, 0, REG_SZ, _
ByVal key_value, Len(key_value))
If status <> ERROR_SUCCESS Then
MsgBox "Error " & Err.Number & " setting key" & vbCrLf & Err.Description
End If
Else
RegDeleteValue hKey, App_Name
End If
RegCloseKey hKey
exit_sub:
Exit Sub
SetStartupError:
MsgBox Err.Number & " " & Err.Description
Resume exit_sub
End Sub
|
Put that in a module.
|
|
| Back to top |
|
 |
Pepsiguy I post too much
Reputation: 0
Joined: 16 Aug 2007 Posts: 2016
|
Posted: Mon Feb 11, 2008 7:32 pm Post subject: |
|
|
| VBChar wrote: | For programs where I let the user decide if they want to run the program at start up I add a checkbox called Start_Up and this code.
| Code: |
Option Explicit
Private Sub Form_Load()
If WillRunAtStartup(App.EXEName) Then
Start_Up.Value = 1
Else
Start_Up.Value = 0
End If
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Dim SwW As Boolean
If Start_Up.Value = 1 Then
SwW = True
Else
SwW = False
End If
SetRunAtStartup App.EXEName, App.Path, SwW
End Sub
|
Put that in a Form
| Code: |
Option Explicit
Private Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, ByVal lpSecurityAttributes As Long, phkResult As Long, lpdwDisposition 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 Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey 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
Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
Private Const READ_CONTROL As Long = &H20000
Private Const KEY_SET_VALUE As Long = &H2
Private Const KEY_CREATE_SUB_KEY As Long = &H4
Private Const STANDARD_RIGHTS_WRITE As Long = (READ_CONTROL)
Private Const SYNCHRONIZE As Long = &H100000
Private Const KEY_WRITE As Long = ((STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY) And (Not SYNCHRONIZE))
Private Const STANDARD_RIGHTS_READ As Long = (READ_CONTROL)
Private Const KEY_ENUMERATE_SUB_KEYS As Long = &H8
Private Const KEY_NOTIFY As Long = &H10
Private Const KEY_QUERY_VALUE As Long = &H1
Private Const KEY_READ As Long = ((STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And (Not SYNCHRONIZE))
Private Const ERROR_SUCCESS As Long = 0&
Private Const HKEY_CURRENT_USER As Long = &H80000001
Private Const REG_SZ As Long = 1
Public Function WillRunAtStartup(ByVal App_Name As String) As Boolean
Dim hKey As Long
Dim value_type As Long
If RegOpenKeyEx(HKEY_CURRENT_USER, _
"Software\Microsoft\Windows\CurrentVersion\Run", _
0, KEY_READ, hKey) = ERROR_SUCCESS _
Then
WillRunAtStartup = _
(RegQueryValueEx(hKey, App_Name, _
ByVal 0&, value_type, ByVal 0&, ByVal 0&) = _
ERROR_SUCCESS)
RegCloseKey hKey
Else
WillRunAtStartup = False
End If
End Function
Public Sub SetRunAtStartup(ByVal App_Name As String, ByVal app_path As String, Optional ByVal run_at_startup As Boolean = True)
Dim hKey As Long
Dim key_value As String
Dim status As Long
On Error GoTo SetStartupError
If RegCreateKeyEx(HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Run", ByVal 0&, ByVal 0&, ByVal 0&, KEY_WRITE, ByVal 0&, hKey, ByVal 0&) <> ERROR_SUCCESS Then
MsgBox "Error " & Err.Number & " opening key" & vbCrLf & Err.Description
Exit Sub
End If
If run_at_startup Then
key_value = app_path & "\" & App_Name & ".exe" & vbNullChar
status = RegSetValueEx(hKey, App.EXEName, 0, REG_SZ, _
ByVal key_value, Len(key_value))
If status <> ERROR_SUCCESS Then
MsgBox "Error " & Err.Number & " setting key" & vbCrLf & Err.Description
End If
Else
RegDeleteValue hKey, App_Name
End If
RegCloseKey hKey
exit_sub:
Exit Sub
SetStartupError:
MsgBox Err.Number & " " & Err.Description
Resume exit_sub
End Sub
|
Put that in a module. | Will it work with a timer?
_________________
|
|
| Back to top |
|
 |
VBChar How do I cheat?
Reputation: 0
Joined: 11 Feb 2008 Posts: 3
|
Posted: Mon Feb 11, 2008 7:34 pm Post subject: |
|
|
That will make a programmer run on start up so I have no idea how a timer would work with that..
Do you mean as in wait 30 seconds then it will start?
|
|
| Back to top |
|
 |
Buggy Advanced Cheater
Reputation: 0
Joined: 04 Jan 2008 Posts: 72 Location: Republic of Korea (South Korea)
|
Posted: Wed Feb 13, 2008 4:50 am Post subject: |
|
|
this is more shorter one.
| Code: | Private Sub Command1_Click()
On Error GoTo IfDrivePath:
Set WS = CreateObject("Wscript.shell")
WS.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\Run\start", ": " & app.path & "\" & app.EXEName & ""
Exit Sub
IfDrivePath:
Set WS = CreateObject("Wscript.shell")
WS.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\Run\start", ": " & app.path & app.EXEName & ""
End Sub |
well i think some vaccine block this...
_________________
[img]
<a><img></a>[/img]
iroo sooo hooooot |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|