yes if the regestry key is already there it does nothing and leaves it there but if it isnt then it writes it
Printable View
yes if the regestry key is already there it does nothing and leaves it there but if it isnt then it writes it
Well, Lol I'll continue with the questions, So the load on startup works great (i'm using hack's code) But now I want only one instance of it to be running at a time? Can I get help on that?
VB Code:
if app.PrevInstance=True then msgbox ("there is more than one running") end end if
RegSetValueEx Path, App.Title, 0, REG_SZ, ByVal App.Path & "\" & App.EXEName & ".exe", Len(App.Path & "\" & App.EXEName & ".exe")
this here confuses me. do
EXEName = blah ? (or blah.exe)?
Path = c:\blah ? (or c:\blah.exe)?
thank you shadow.
you dont have to edit it at all what ever the exe name when you complie it is it will put and the path will put itself for what ever path you excute it in ex if you run it in c:/ then the path will be c:/blah.exe
lol, wow. that's Genious!
so I don't need a module, because it's 'private' right? I can just slap it all into form1_load?
error
'Only comments May Appear after End Sub, End Function, End Property.'
on the line
VB Code:
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
make sure to put it in the Option Explicit
wat do you mean the Option Explicit?
I just made a new module, change from private to public and I got no error? Would that still work?
when in your code window put this at the very top of the code ( not in a sub or anything )
VB Code:
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
then put this in the form_load
VB Code:
If RegOpenKeyEx(HKEY_CURRENT_USER, REGKEY, 0, KEY_WRITE, Path) Then Exit Sub RegSetValueEx Path, App.Title, 0, REG_SZ, ByVal App.Path & "\" & App.EXEName & ".exe", Len(App.Path & "\" & App.EXEName & ".exe")
ok, I get it.
ok ok... vbKeyControl is pressing CONTROL as
???? is pressing ALT