Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to check whether a program is available on a PC Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
04-Oct-02
Category
Win API
Language
Delphi 2.x
Views
116
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			 Author: Jonas Bilinkevicius

How do you find out whether a program is available ? For example, how can you 
programmatically tell whether MS Word 2000 is installed rather than Lotus WordPro? 
The OS can be Win95, 98, ME, 2000, NT4. I did not find any Win API function 
allowing to find out if a specific application exists on the machine. The nearest I 
found is the FindExecutable function but you need to pass it a document file name. 
Should I read the registry, to enumerate the currently installed applications?

Answer:

For the MS Word case, you might want to start Word in automation mode to see if its 
present. The following routine does that:
1   
2   function IsWordPresent(var IsActive: Boolean): Boolean;
3   var
4     MSWord: Variant;
5   begin
6     Result := False;
7     IsActive := False;
8     try
9       MSWord := GetActiveOleObject('Word.Application');
10      Result := not VarIsEmpty(MSWord);
11      IsActive := not VarIsEmpty(MSWord)
12    except
13      MSWord := Unassigned
14    end;
15    if VarIsEmpty(MSWord) then
16    begin
17      try
18        MSWord := CreateOleObject('Word.Application');
19        Result := not VarIsEmpty(MSWord);
20        if Result then
21          MSWord.Quit
22      except
23      end;
24    end;
25  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC