Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Implementing Imported TLB Interfaces

182 views
Skip to first unread message

Tibor Csonka

unread,
Dec 2, 2005, 5:22:05 AM12/2/05
to
Hello,

In Delphi you have the possiblity to import a TLB file in your project.
The importer will generate you a xxx_TLB.pas with interfaces from the
TLB file. The file is similar to what the Type Library Editor is making
for you.

I am trying to do the following:
1. import mshtml.tlb as mshtml_tlb.pas
2. implement some of the interfaces from there
3. implement an IActiveScriptSite to execute some scripts on the
automation objects supporting interfaces from MSHTML

The scripting part was the most easy to implement, and it is working
fine. Also, I was able to export some of my own automation objects not
supporting the interfaces from mshtml.tlb.

I was able to make some steps:
1. imported the mshtml.tlb to have the interfaces (created the file
mshtml_tlb.pas)
2. took the IHTMLWindow2 interface and implemented it in an TAutoObject
descendant class
3. linked the original tlb file compiled as a resource in my project

After all these steps when in the initialization section of my
HTMLWindow2 implementation unit I call TAutoObjectFactory.Create(...),
an EOleSysError exception is thrown with message 'Old format or invalid
type library'.

I have also tried to load up the type library from the executable
manually with LoadTypeLib function and the same error is returned.

My resource script looks like this:
1 typelib "mshtml.tlb"

I compile it with Delphi 7 resource compiler and include it in my
project with $R.

Any help or advice would be greatly appreciated.

Kind regards,
Tibor Csonka

Dmitry Streblechenko

unread,
Dec 2, 2005, 12:29:07 PM12/2/05
to
Why would you want to *implement* IHTMLWindow2 interface? IE already does
that for you. What exactly are you trying to do?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Tibor Csonka" <b...@rawbite.ro> wrote in message
news:4390201c$1...@newsgroups.borland.com...

Tibor Csonka

unread,
Dec 6, 2005, 7:18:13 AM12/6/05
to
> Why would you want to *implement* IHTMLWindow2 interface? IE already
does

Because I want to expose objects to JScript which are similar to the
objects ob IE but not the same. For that I should implement the same
automation interfaces as IE.

Any idea about the error message I got?

Dmitry Streblechenko

unread,
Dec 7, 2005, 4:10:11 PM12/7/05
to
Did you modify the tlb to change the class GUIDs? Otherwise you can really
hose up your system since all other apps will now be creating your objects
rather than the ones that belong to IE.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Tibor Csonka" <b...@rawbite.ro> wrote in message

news:4395814a$1...@newsgroups.borland.com...

Tibor Csonka

unread,
Dec 8, 2005, 2:56:17 AM12/8/05
to
> Did you modify the tlb to change the class GUIDs? Otherwise you can
really
> hose up your system since all other apps will now be creating your
objects
> rather than the ones that belong to IE.

Not really because, as I understood, you can register com objects only
for your current process. Is this not true?

Dmitry Streblechenko

unread,
Dec 8, 2005, 2:32:13 PM12/8/05
to
Depends on the flags passed to TAutoObjectFactory.Create - ciInternal vs all
other flags.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Tibor Csonka" <b...@rawbite.ro> wrote in message

news:4397e6e2$1...@newsgroups.borland.com...

0 new messages