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 Documentation for Type Library 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
09-Jun-03
Category
OLE
Language
Delphi 6.x
Views
120
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Nik Ozniev

Recently I developed Automation Server for reports in Word and was surprised with 
failure trying to get Help String for TypeLibrary

Answer:

Recently I developed Automation Server for reports in Word and was surprised with 
failure trying to get Help String for TypeLibrary by following code 

1   var
2     k, InfoCount: Integer;
3     TypeLib: ITypeLib;
4     TypeLibGUID: TGUID;
5     ErrorStr: string;
6     HRes: HResult;
7     pbstrDocString, pbstrName: WideString;
8   begin
9     Memo1.Lines.Clear;
10    // InputGUIDString is given input string value
11    TypeLibGUID := StringToGUID(InputGUIDString);
12    // loads Type Library from registry
13    HRes := LoadRegTypeLib(TypeLibGUID, 1, 0, 0, TypeLib);
14    if Failed(HRes) then
15      Exit;
16  
17    // believing in mind, that so it is in practice!
18    InfoCount := TypeLib.GetTypeInfoCount;
19    for k := 0 to kInfoCount - 1 do
20    begin
21      HRes := TypeLib.GetDocumentation(k, @pbstrName, @pbstrDocString, nil, nil);
22      if Failed(HRes) then
23        Continue;
24      Memo1.Lines.Add(pbstrName + ': ' + pbstrDocString);
25    end;


Here was no errors! 
But the thing is that help string for Type Library resides beyond the range 
[0..kInfoCount-1] so TypeLib.GetTypeInfoCount reports about ITypeInfo count, 
excluding ITypeInfo for himself. Did you know about it? 
To get Help String for self Type Library one must implement 

TypeLib.GetDocumentation(-1, @pbstrName, @pbstrDocString, nil, nil);

Isn't it unexpectedly for Delphi programmers? I didn't found anything about it in Delphi help!

			
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