473,785 Members | 2,369 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to check for installed compnents?

I'm trying to create an MSI in VS.NET that will check for installed Office
System components - so my MDE will only install if requirements are met.
I'm thinking about using VBScript to inspect Registry keys/values. Anyone
travel this road before? Other suggestions?

Thanks in advance.
Nov 12 '05 #1
32 5134
Hi,
Just an idea, but couldn't this be done using the FileSearch Object?

--
HTH,
Don
=============== ==============
Use My*****@Telus.N et for e-mail
Disclaimer:
Professional PartsPerson
Amateur Database Programmer {:o)

I'm an Access97 user, so all posted code
samples are also Access97- based
unless otherwise noted.

Do Until SinksIn = True
File/Save, <slam fingers in desk drawer>
Loop

=============== =============== ==

"deko" <de*****@hotmai l.com> wrote in message
news:PT******** ***********@new ssvr25.news.pro digy.com...
I'm trying to create an MSI in VS.NET that will check for installed Office
System components - so my MDE will only install if requirements are met.
I'm thinking about using VBScript to inspect Registry keys/values. Anyone
travel this road before? Other suggestions?

Thanks in advance.

Nov 12 '05 #2
> Just an idea, but couldn't this be done using the FileSearch Object?

I tried this:

Public Function CheckComponents () As Boolean
On Error GoTo HandleErr
Dim varExe As Variant
CheckComponents = False
For Each varExe In Array("WINWORD. EXE", "OUTLOOK.EX E", "EXCEL.EXE" )
With Application.Fil eSearch
.NewSearch
.LookIn = "C:\Program Files\Microsoft Office\OFFICE11 \"
.SearchSubFolde rs = False
.Filename = varExe
.MatchTextExact ly = True
.FileType = msoFileTypeAllF iles
CheckComponents = IIf(.Execute(), True, False)
End With
If CheckComponents = False Then
MsgBox varExe & " is required for for this application to
function properly."
Exit For
End If
Next
Exit Function

But it's *very* slow. Still, the idea of checking for installed components
from within the app, rather than with an install routine, may be an
option...

Nov 12 '05 #3
deko wrote:
Just an idea, but couldn't this be done using the FileSearch Object?

I tried this:

Public Function CheckComponents () As Boolean
On Error GoTo HandleErr
Dim varExe As Variant
CheckComponents = False
For Each varExe In Array("WINWORD. EXE", "OUTLOOK.EX E", "EXCEL.EXE" )
With Application.Fil eSearch
.NewSearch
.LookIn = "C:\Program Files\Microsoft Office\OFFICE11 \"
.SearchSubFolde rs = False
.Filename = varExe
.MatchTextExact ly = True
.FileType = msoFileTypeAllF iles
CheckComponents = IIf(.Execute(), True, False)
End With
If CheckComponents = False Then
MsgBox varExe & " is required for for this application to
function properly."
Exit For
End If
Next
Exit Function

But it's *very* slow. Still, the idea of checking for installed components
from within the app, rather than with an install routine, may be an
option...


I put a timer function in yours similar to the one in my modified
version below:

Function CheckComps()
Dim varExe As Variant
Dim sngStart As Single
sngStart = Timer
CheckComps = False
For Each varExe In Array("WINWORD. EXE", "OUTLOOK.EX E", "EXCEL.EXE" )
CheckComps = Len(Dir$("C:\Pr ogram Files\Microsoft
Office\OFFICE10 \" & varExe)) > 0
If CheckComps = False Then
MsgBox varExe & " is required for for this application to
function properly."
Exit For
End If
Next
Debug.Print "CheckComps done " & Timer - sngStart

End Function

The result:
CheckComponants done 0.1875
CheckComponants done 0.1875
CheckComponants done 0.203125
CheckComponants done 0.1875
CheckComponants done 0.203125
CheckComps done 0
CheckComps done 0
CheckComps done 0
CheckComps done 0

Good old Dir$()

--
Error reading sig - A)bort R)etry I)nfluence with large hammer
Nov 12 '05 #4
I realise these are first attempts but both are flwed to some extent as the
Office folder path is hardcoded.

If on the other hand you check the registry at
HKLM\Software\M icrosoft\Office \{version}\{app lication}\Insta llRoot\Path

Where
{version} is 8.0, 9.0, 10.0 etc.
{application} is Word, Outlook or Excel

This will tell you where the exe should be installed.
--
Terry Kreft
MVP Microsoft Access
"Trevor Best" <nospam@localho st> wrote in message
news:40******** *************** @auth.uk.news.e asynet.net...
deko wrote:
Just an idea, but couldn't this be done using the FileSearch Object?

I tried this:

Public Function CheckComponents () As Boolean
On Error GoTo HandleErr
Dim varExe As Variant
CheckComponents = False
For Each varExe In Array("WINWORD. EXE", "OUTLOOK.EX E", "EXCEL.EXE" )
With Application.Fil eSearch
.NewSearch
.LookIn = "C:\Program Files\Microsoft Office\OFFICE11 \"
.SearchSubFolde rs = False
.Filename = varExe
.MatchTextExact ly = True
.FileType = msoFileTypeAllF iles
CheckComponents = IIf(.Execute(), True, False)
End With
If CheckComponents = False Then
MsgBox varExe & " is required for for this application to
function properly."
Exit For
End If
Next
Exit Function

But it's *very* slow. Still, the idea of checking for installed components from within the app, rather than with an install routine, may be an
option...


I put a timer function in yours similar to the one in my modified
version below:

Function CheckComps()
Dim varExe As Variant
Dim sngStart As Single
sngStart = Timer
CheckComps = False
For Each varExe In Array("WINWORD. EXE", "OUTLOOK.EX E", "EXCEL.EXE" )
CheckComps = Len(Dir$("C:\Pr ogram Files\Microsoft
Office\OFFICE10 \" & varExe)) > 0
If CheckComps = False Then
MsgBox varExe & " is required for for this application to
function properly."
Exit For
End If
Next
Debug.Print "CheckComps done " & Timer - sngStart

End Function

The result:
CheckComponants done 0.1875
CheckComponants done 0.1875
CheckComponants done 0.203125
CheckComponants done 0.1875
CheckComponants done 0.203125
CheckComps done 0
CheckComps done 0
CheckComps done 0
CheckComps done 0

Good old Dir$()

--
Error reading sig - A)bort R)etry I)nfluence with large hammer

Nov 12 '05 #5
> If on the other hand you check the registry at
HKLM\Software\M icrosoft\Office \{version}\{app lication}\Insta llRoot\Path
Where
{version} is 8.0, 9.0, 10.0 etc.
{application} is Word, Outlook or Excel

This will tell you where the exe should be installed.


Good suggestion. What I really want to do is prevent installation of the
MDE if any of the Office programs are missing. If the MDE installs without
the other programs, the result is Missing References and ugly errors.

I've successfully created a basic MSI, and have a VBScript that checks those
registry locations - on the assumption the component is installed if the
InstallRoot\Pat h Key is not null, but getting the script into a Custom
Action in the Installer has been a real time suck. I'm new to creating
MSI's - but my version of Visual Studio can create them and that's what I've
been using. If I could figure out the Installer I'd be all set.
Nov 12 '05 #6
Terry Kreft wrote:
I realise these are first attempts but both are flwed to some extent as the
Office folder path is hardcoded.


I don't try to be too clever when writing aircode or modifying someone
elses code for usenet purposes, had I been writing this in a real app I
would have used SysCmd(acSysCmd AccessDir), a bit easier than snooping
around the registry :-)

--
Error reading sig - A)bort R)etry I)nfluence with large hammer
Nov 12 '05 #7
> would have used SysCmd(acSysCmd AccessDir), a bit easier than snooping
around the registry :-)


I came up with this, but in testing it never ran - I just got the "Missing
Reference" errors. The start up form never had a chance to open. Oh well,
back to the Installer...

Anyway, thanks for the help.

Public Function CheckComponents () As Boolean
Dim varExe As Variant
Dim strApp As String
Dim blnQuit As Boolean
blnQuit = False
For Each varExe In Array("WINWORD. EXE", "OUTLOOK.EX E", "EXCEL.EXE" )
CheckComponents = Len(Dir$(SysCmd (acSysCmdAccess Dir) & varExe)) > 0
If CheckComponents = False Then
blnQuit = True
Select Case varExe
Case "WINWORD.EX E"
strApp = "Word"
Case "OUTLOOK.EX E"
strApp = "Access"
Case "EXCEL.EXE"
strApp = "Excel"
End Select
MsgBox "Microsoft " & strApp & " is required for for this " & _
"applicatio n to function properly.", vbCritical, " Microsoft " &
strApp & " Not Found"
End If
Next
If blnQuit Then DoCmd.Quit
Exit Function
Nov 12 '05 #8
deko wrote:
would have used SysCmd(acSysCmd AccessDir), a bit easier than snooping
around the registry :-)

I came up with this, but in testing it never ran - I just got the "Missing
Reference" errors. The start up form never had a chance to open. Oh well,
back to the Installer...

Anyway, thanks for the help.


That's because you're using early binding still, you will need to
uncheck the references and use late binding (use early binding for
development to get intellisense, etc), then for example change:

Dim wb as new excel.workbook
wb.dosomthing

to

dim wb as object
set wb=createobject ("excel.workboo k")
wb.dosomthing
--
Error reading sig - A)bort R)etry I)nfluence with large hammer
Nov 12 '05 #9
"Terry Kreft" <te*********@mp s.co.uk> wrote in
news:7d******** ************@ka roo.co.uk:
I realise these are first attempts but both are flwed to some
extent as the Office folder path is hardcoded.

If on the other hand you check the registry at
HKLM\Software\M icrosoft\Office \{version}\{app lication}\Insta llR
oot\Path

Where
{version} is 8.0, 9.0, 10.0 etc.
{application} is Word, Outlook or Excel

This will tell you where the exe should be installed.


Note that Access itself does not follow the same rules.

A97 uses:

HKEY_LOCAL_MACH INE, "SOFTWARE\Micro soft\Office\8.0 \OfficeBin\Path

A2K uses:

HKEY_LOCAL_MACH INE,
"SOFTWARE\Micro soft\Office\8.0 \Access\Install Root\Path

OR

HKEY_LOCAL_MACH INE,
"SOFTWARE\Micro soft\Office\8.0 \Common\Install Root\Path

It's a pain. A real pain.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 12 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

32
537
by: deko | last post by:
I'm trying to create an MSI in VS.NET that will check for installed Office System components - so my MDE will only install if requirements are met. I'm thinking about using VBScript to inspect Registry keys/values. Anyone travel this road before? Other suggestions? Thanks in advance.
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10341
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9954
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8979
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7502
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.