Solved

Auto load VB5 Application

Posted on 1998-08-27
3
141 Views
Last Modified: 2010-04-30
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
Comment
Question by:altecl
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 100 total points
ID: 1431543
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
 

Author Comment

by:altecl
ID: 1431544
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
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1431545
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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now