• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 158
  • Last Modified:

Auto load VB5 Application

Hi,

I just want to know how to to code a program that when WIN95 started it will automatically RUN(NOTE: not using startup).

altecl
0
altecl
Asked:
altecl
  • 2
1 Solution
 
MikeP090797Commented:
Put this in a module:

Public Const REG_SZ = 1
Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Declare Function RegSetValue Lib "advapi32.dll" Alias "RegSetValueA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long


Put this in form_load:

Dim hKey As Long
RegOpenKey HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run", hKey

RegSetValue hKey, "", REG_SZ, App.Path & "\App.exe", Len(App.Path & "\App.exe")

0
 
alteclAuthor Commented:
mikep

I just want to clarify:

Once i made this program i have to compile it to exe and what directory should i put the EXE files of this porgram.

thank you
0
 
MikeP090797Commented:
After you make the EXE, you can put it wherever you want. The code above registers it to run on startup using program's current location
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now