Solved

Making A setup program

Posted on 2001-09-06
11
172 Views
Last Modified: 2008-02-26
Hello,
 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.
Cheers
0
Comment
Question by:smash81
  • 3
  • 3
  • 2
  • +2
11 Comments
 
LVL 12

Expert Comment

by:roverm
ID: 6463129
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.

D'Mzzl!
RoverM
0
 
LVL 3

Expert Comment

by:Rem
ID: 6463152
Hi,

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.

Bye

Rem
0
 
LVL 12

Expert Comment

by:roverm
ID: 6463189
The exact name for the ODE Tools:

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

D'Mzzl!
RoverM
0
 
LVL 1

Expert Comment

by:riaz9
ID: 6463230
Hi,

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)

cn.open "test.mdb"
use
cn.open app.path & "\test.mdb"
(in case you are installing the .mdb in the same folder as your .exe)

bye,

Riaz
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6463254
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.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:smash81
ID: 6463278
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.
Cheers
 
0
 
LVL 3

Expert Comment

by:Rem
ID: 6463285
The dependence file is not necessary but can be helpful.
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 6463313
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
Next

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 *****

Const INFINITE = &HFFFF
Const STARTF_USESHOWWINDOW = &H1
Private Enum enSW
    SW_HIDE = 0
    SW_NORMAL = 1
    SW_MAXIMIZE = 3
    SW_MINIMIZE = 6
End Enum
Private Type PROCESS_INFORMATION
    hProcess As Long
    hThread As Long
    dwProcessId As Long
    dwThreadId As Long
End Type
Private Type STARTUPINFO
    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
Private Type SECURITY_ATTRIBUTES
    nLength As Long
    lpSecurityDescriptor As Long
    bInheritHandle As Long
End Type
Private Enum enPriority_Class
    NORMAL_PRIORITY_CLASS = &H20
    IDLE_PRIORITY_CLASS = &H40
    HIGH_PRIORITY_CLASS = &H80
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
    Dim pinfo As PROCESS_INFORMATION
    Dim sec1 As SECURITY_ATTRIBUTES
    Dim sec2 As SECURITY_ATTRIBUTES
    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
        'Wait
        WaitForSingleObject pinfo.hProcess, dwMilliseconds
        SuperShell = True
    Else
        SuperShell = False
    End If
End Function

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


2)
0
 

Author Comment

by:smash81
ID: 6463361
You seem to be a VB Guru!
I wonder how long I will take to reach your level.
You're simply Great!!!!
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6463380
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.
0
 

Author Comment

by:smash81
ID: 6463801
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.
Thanks
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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…

759 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