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 get the Word version on a client 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
17-Oct-02
Category
Win API
Language
Delphi 6.x
Views
117
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius 

Using D6 I need to extract the Word version on the client computer. The options are 
Word97, Word2000 and WordXP.

Answer:

1   function GetCurrentWordMajorVersion: Integer;
2   var
3     vRegistry: TRegistry;
4     vVersionStr: string;
5     vVersion: string;
6   begin
7     Result := -1;
8     vRegistry := TRegistry.Create(KEY_READ);
9     try
10      vRegistry.RootKey := HKEY_CLASSES_ROOT;
11      if vRegistry.OpenKeyReadOnly('Word.Application\CurVer') then
12      begin
13        {Get the default value: 'Word.Application.10'}
14        vVersionStr := vRegistry.ReadString('');
15        {Extract the major version from the string}
16        vVersion := System.Copy(vVersionStr, Succ(LastDelimiter('.', vVersionStr)),
17          MAXINT);
18        {8=Word97, 9=Word2000, 10=Word2002, etc.}
19        Result := StrToIntDef(vVersion, -1);
20      end;
21    finally
22      vRegistry.Free;
23    end;
24  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