Solved

Auto load VB5 Application

Posted on 1998-08-27
3
148 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sending a email via excel using vba 6 96
Formula problem with Excel attachment 6 38
which modules are active in VB6 project? 6 39
Problem to line 23 53
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

790 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