Visit our Sponsor   Visit our Sponsor
delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback





Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi







Startblatt.de






Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (0)


GetDocumentation for Type LibraryFormat this article printer-friendly!Bookmark function is only available for registered users!
How get Help String for Type Library himself
Product:
Delphi 6.x (or higher)
Category:
OLE
Skill Level:
Scoring:
Last Update:
12/22/2002
Search Keys:
delphi delphi3000 article borland vcl code-snippet Type Library GetDocumentation HelpString
Times Scored:
2
Visits:
4340
Uploader: Nik Ozniev
Company:
Reference: N/A
 
Question/Problem/Abstract:
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

Var
  k, InfoCount : Integer;
  TypeLib : ITypeLib;
  TypeLibGUID : TGUID;
  ErrorStr: String;
  HRes : HResult;
  pbstrDocString, pbstrName : WideString;
begin
  Memo1.Lines.Clear;
  // InputGUIDString is given input string value
  TypeLibGUID := StringToGUID(InputGUIDString);
  // loads Type Library from registry
  HRes := LoadRegTypeLib(TypeLibGUID, 1, 0, 0, TypeLib);
  if Failed(HRes) then
    Exit;

  // believing in mind, that so it is in practice!
  InfoCount := TypeLib.GetTypeInfoCount;   for k:=0 to kInfoCount-1 do
    begin
      HRes := TypeLib.GetDocumentation(k, @pbstrName, @pbstrDocString, nil, nil);
      if Failed(HRes) then
        Continue;
      Memo1.Lines.Add(pbstrName + ': ' + pbstrDocString);
    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!





Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment













 
Sign up to consume product discounts for Bronze memberships !

read more


  Visit our Sponsor

 

  Community Ad of
Peganza
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)