Making A setup program

 I have completed a project in VB and Access.Before i can package and distribute it I would like to know a couple of things.

1. I want to make the program in such a way that the  client need not have Access installed on his machine.

2 I need to modify the setup program in such a way that it automatically installs DCOM98 from the installation CD to the clients machine and also copies a default database from the installation CD to the clients machine.

Can anyone please give me the steps to follow in order to achieve this.
Thank you.
Who is Participating?
TimCotteeConnect With a Mentor Head of Software ServicesCommented:
It would be something as simple as shelling out to the DCOM setup.exe on your CD. Now that isn't necessarily as simple as it sounds, you need to consider a few things.

1) Identify CD Rom Drive letter.
2) Want to shell out but wait until process is complete.

1) There are a number of ways to do this, either with API, FSO or cheat. My advice is probably cheat;

For i = 3 to 26
  If Dir(Chr(64 + i) & ":\MyDComFolder\DCOM98.EXE") <> "" Then
    'Call DCOM install from here
    Exit For
  End If

This loops through drives C: to Z: looking for the DCOM exe in the specified folder, it will probably only find it on the CD drive so it runs it from there.

2) Combine this code with that above and it will shell the sub process and wait for it to complete before continuing. You should place this code in a new module in the setup project and call it from the appropriate place in the setup1 code. This setup project is reasonably well commented so you should be able to place the code where
you want to.

***** Shell and Wait Module Code *****

Private Enum enSW
    SW_HIDE = 0
    SW_NORMAL = 1
End Enum
    hProcess As Long
    hThread As Long
    dwProcessId As Long
    dwThreadId As Long
End Type
    cb As Long
    lpReserved As String
    lpDesktop As String
    lpTitle As String
    dwX As Long
    dwY As Long
    dwXSize As Long
    dwYSize As Long
    dwXCountChars As Long
    dwYCountChars As Long
    dwFillAttribute As Long
    dwFlags As Long
    wShowWindow As Integer
    cbReserved2 As Integer
    lpReserved2 As Byte
    hStdInput As Long
    hStdOutput As Long
    hStdError As Long
End Type
    nLength As Long
    lpSecurityDescriptor As Long
    bInheritHandle As Long
End Type
Private Enum enPriority_Class
End Enum
Private Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As SECURITY_ATTRIBUTES, lpThreadAttributes As SECURITY_ATTRIBUTES, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long

Public Function SuperShell(ByVal App As String, ByVal WorkDir As String, dwMilliseconds As Long, ByVal start_size As enSW, ByVal Priority_Class As enPriority_Class) As Boolean
    Dim pclass As Long
    Dim sinfo As STARTUPINFO
    sec1.nLength = Len(sec1)
    sec2.nLength = Len(sec2)
    sinfo.cb = Len(sinfo)
    sinfo.dwFlags = STARTF_USESHOWWINDOW
    sinfo.wShowWindow = start_size
    pclass = Priority_Class
    If CreateProcess(vbNullString, App, sec1, sec2, False, pclass, _
    0&, WorkDir, sinfo, pinfo) Then
        WaitForSingleObject pinfo.hProcess, dwMilliseconds
        SuperShell = True
        SuperShell = False
    End If
End Function

SuperShell "DCOM", Chr(64+i) & ":\MyDComFolder", 0, SW_NORMAL, HIGH_PRIORITY_CLASS

Q1: Use the Microsoft ODE Tools For Access. This is a kind-of P & D wizard for Access in which you can create a distribution without the need for Access on the clients machine (eg:  include the runtime library of Access)

Q2: In the ODE tools you can add, at the end, all programs, batch files and so on you wish to run after installation.


If your project is a vb program relying on an access database you won't need having access installed on client machines.
Use the deployment tool shipped with VB.
Include the access database (just the mdb), the DCOM98 only if the client machines are under win95 or 98. No need for it under NT or 2000.
Don't forget to include the mdac (preferrably the latest version.
If these tools are properly included (and the deployment wizzard is easy to use), everything (including the mdac) will be installed according to your demands.

Hope this helps you out.


Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

The exact name for the ODE Tools:

Microsoft Office Developer Edition 97.
We've got it from the Select CD: Feb.97 Release.


As suggested by rem you can use package and deployment wizard, be sure to include the .mdb file and since during installation the user can install the files to any directory, you will have to take care of this in your application.  

Instead of using something like(in ADO's) "test.mdb"
use app.path & "\test.mdb"
(in case you are installing the .mdb in the same folder as your .exe)


TimCotteeHead of Software ServicesCommented:
smash81: The guidance you have been given is great so far. You can copy the sample db easily by adding it to the list of files in the p&d wizard. You can also specify the target directory for this file. Now for installing DCOM automatically that is a slightly different issue. You have two options really. You can either include it as you would the db and copy it to the local machine and rely on the first run of your application to determine whether it is installed or not and install it if required, or to modify the setup1 application that is used to install the application. The code for this can be found in a sub folder of the ...\vb98\wizards\pdwizard folder on your development machine. This is used by the p&d wizard to install the application. Any modifications you make to it should be saved seperately from the existing version as they will be used for all subsequent builds if you don't. You can modify this to check for DCOM and install it if required, many people do so in order to create desktop shelllinks. This would provide the most transparent method to your users but is more complex to implement.
smash81Author Commented:
Thank you all,
 I am grateful to you guys for this help.Timcotte has been very helpful.
 TimCotte, there is one thing that i dont understand here, what code do i need to put in the setup project that will help me install the DCOM automatically.There are so many forms in the project that i dont want to take a chance with it.One more thing, do i really need to create a dependance file.Please let me have these details.Thank you.
The dependence file is not necessary but can be helpful.
smash81Author Commented:
You seem to be a VB Guru!
I wonder how long I will take to reach your level.
You're simply Great!!!!
TimCotteeHead of Software ServicesCommented:
Just hang around here long enough and you will learn a hell of a lot. I thought I new a fair bit when I started and then it took me a few months just to get an answer accepted. Over the last couple of years I have had a number of projects at work and contributed here in 1000s of questions the amount of knowledge built up through my participation here means that I now know nearly as much as I thought I did a couple of years ago.
smash81Author Commented:
Hey TimCottee
 I tried following your guidance but am stuck at one point.When I was packaging the application, I tried to add the database in the file list.By default it was expecting files of type exe.Now, here do i have to put the access application or the database.ANother thing is that the database target location is set by default.What if i want to save it on into some other folder like c:\smash81\file.mdb, how can i achieve this.

Please help again.
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.

All Courses

From novice to tech pro — start learning today.