BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: Import type library, Delphi 6, generation of PAS file fa

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi ActiveX Controls Usage
View previous topic :: View next topic  
Author Message
Deborah Pate (TeamB)
Guest





PostPosted: Tue Oct 21, 2003 9:16 am    Post subject: Re: Import type library, Delphi 6, generation of PAS file fa Reply with quote



< Is the problem that causes this behaviour in Delphi 6?
Quote:


Yes. The D6 type library importer was buggy.

The best workaround is to use D5 to import the type library
and use the resulting file in D6. If you haven't got D5,
I'm afraid you have to edit the file by hand. It's
generally quite simple, though boring, to do; the procedure
you gave should probably look like this, for example:

procedure TMyDrv.Set_DataEventRate(Param1:
MyDataEventRate);
begin
DefaultInterface.Set_DataEventRate(Param1);
end;

--
Deborah Pate (TeamB) http://delphi-jedi.org

TeamB don't see posts sent via Google or ISPs
Use the real Borland server: newsgroups.borland.com
http://www.borland.com/newsgroups/genl_faqs.html



Back to top
Gary Wardell
Guest





PostPosted: Tue Nov 04, 2003 9:00 am    Post subject: Re: Import type library, Delphi 6, generation of PAS file fa Reply with quote



Quote:

Yes. The D6 type library importer was buggy.


Hi,

I'm also using Delphi 6.

I'm thinking the problem I'm having using a COM+ object created in VB6 is
probably related to this issue.

Is there any documentation on what needs to be done for this rewriting? I'm
new to Delphi.

Gary



Back to top
Deborah Pate (TeamB)
Guest





PostPosted: Tue Nov 04, 2003 11:14 am    Post subject: Re: Import type library, Delphi 6, generation of PAS file fa Reply with quote



< Is there any documentation on what needs to be done for
this rewriting? I'm new to Delphi.
Quote:


When you import a type library in D6 a lot of property
setters end up looking like this:
procedure TCOMThingy.Set_SomeProperty(AParam: Integer);
begin
Exit;
end;
which as you can see is not much use. To fix it you just
call the same method on the DefaultInterface. For example:
procedure TCOMThingy.Set_SomeProperty(AParam: Integer);
begin
DefaultInterface.Set_SomeProperty(AParam);
end;

Make sure you don't reimport the type library after doing
these corrections, though, as it will just write over them
all.

--
Deborah Pate (TeamB) http://delphi-jedi.org

TeamB don't see posts sent via Google or ISPs
Use the real Borland server: newsgroups.borland.com
http://www.borland.com/newsgroups/genl_faqs.html



Back to top
Gary Wardell
Guest





PostPosted: Tue Nov 04, 2003 6:16 pm    Post subject: Re: Import type library, Delphi 6, generation of PAS file fa Reply with quote

Quote:
which as you can see is not much use.

Yes, I can see that.

In my case what I got was more like this:
============
procedure TMail.Set_RemoteHost(var Param1: WideString);
var
InterfaceVariant: OleVariant;
begin
InterfaceVariant := DefaultInterface;
InterfaceVariant.RemoteHost := Param1;
end;
function TMail.Get_RemoteHost: WideString;
begin
Result := DefaultInterface.RemoteHost;
end;
==========
Which mostly looks OK to me.

However, after reading your post I, on a whim, tried removing the var from
the parameter and then it worked. However the compiler error message was
very cryptic, saying it needed another parameter, when there already was one
on the right and the property was on the left of the assignment anyway.

Now, should I change the variant bit also?

Gary




Back to top
Deborah Pate (TeamB)
Guest





PostPosted: Tue Nov 04, 2003 6:40 pm    Post subject: Re: Import type library, Delphi 6, generation of PAS file fa Reply with quote

< Which mostly looks OK to me.
Quote:


It mostly is, but there can be problems. The fact that
InterfaceVariant is a variant means that the call is made
using late binding. As well as being slower this may also
cause problems with the parameters, as sometimes parameters
should not be passed in late binding. So if I were you I
should try using
DefaultInterface.Set_RemoteHost(Param1);
instead of all that InterfaceVariant stuff.

--
Deborah Pate (TeamB) http://delphi-jedi.org

TeamB don't see posts sent via Google or ISPs
Use the real Borland server: newsgroups.borland.com
http://www.borland.com/newsgroups/genl_faqs.html



Back to top
Apostolos Dimopoulos
Guest





PostPosted: Tue Nov 18, 2003 12:37 pm    Post subject: Re: Import type library, Delphi 6, generation of PAS file fa Reply with quote

I remember there was a free utility which I have used in the past that
allowed the creation of the type library file. Unfortunately even though I
need it, I can't find it right now because I am working on a new PC. Any
help if someone else has also used it would be appreciated. Also what about
delphi 7 does its type library importer work correctly?

Apostolos


"Deborah Pate (TeamB)" <d.pate (AT) blueyonder (DOT) co.not-this-bit.uk> wrote in
message news:VA.00001da2.0bf79b34 (AT) blueyonder (DOT) co.not-this-bit.uk...
Quote:
Gary Wardell:
Which mostly looks OK to me.


It mostly is, but there can be problems. The fact that
InterfaceVariant is a variant means that the call is made
using late binding. As well as being slower this may also
cause problems with the parameters, as sometimes parameters
should not be passed in late binding. So if I were you I
should try using
DefaultInterface.Set_RemoteHost(Param1);
instead of all that InterfaceVariant stuff.

--
Deborah Pate (TeamB) http://delphi-jedi.org

TeamB don't see posts sent via Google or ISPs
Use the real Borland server: newsgroups.borland.com
http://www.borland.com/newsgroups/genl_faqs.html





Back to top
Deborah Pate (TeamB)
Guest





PostPosted: Tue Nov 18, 2003 7:43 pm    Post subject: Re: Import type library, Delphi 6, generation of PAS file fa Reply with quote

< Also what about delphi 7 does its type library importer
work correctly?
Quote:


Yes, it was fixed.

--
Deborah Pate (TeamB) http://delphi-jedi.org

TeamB don't see posts sent via Google or ISPs
Use the real Borland server: newsgroups.borland.com
http://www.borland.com/newsgroups/genl_faqs.html



Back to top
Apostolos Dimopoulos
Guest





PostPosted: Wed Nov 19, 2003 11:22 am    Post subject: Re: Import type library, Delphi 6, generation of PAS file fa Reply with quote

Hi,

I am afraid not it has not been corrected, at least not entirely in Delphi 7
either. I tried it yesterday on another computer in the company with Delphi
7 and still had problems of the kind:

procedure TFaxMan.Set_LogResolution(index: Integer; const Param2:
WideString);
{ Warning: The property LogResolution has a setter and a getter whose
types do not match. Delphi was unable to generate a property of
this sort and so is using a Variant as a passthrough. }
var
InterfaceVariant: OleVariant;
begin
InterfaceVariant := DefaultInterface;
InterfaceVariant.LogResolution := Param2;
end;

This compiled correctly but did not function in the runtime. I tried to
correct it by changing it to :

procedure TFaxMan.Set_LogResolution(index: Integer; const Param2:
WideString);
{ Warning: The property LogResolution has a setter and a getter whose
types do not match. Delphi was unable to generate a property of
this sort and so is using a Variant as a passthrough. }
var
InterfaceVariant: OleVariant;
begin
//InterfaceVariant := DefaultInterface;
//InterfaceVariant.LogResolution := Param2;
DefaultInterface.LogResolution[index] := Param2;
end;

which seems to work, but still I am not sure whether it is as it should be.

Any suggestions?

Thanks in advance,
Apostolos


"Deborah Pate (TeamB)" <d.pate (AT) blueyonder (DOT) co.not-this-bit.uk> wrote in
message news:VA.00001dca.0088d0e7 (AT) blueyonder (DOT) co.not-this-bit.uk...
Quote:
Apostolos Dimopoulos:
Also what about delphi 7 does its type library importer
work correctly?


Yes, it was fixed.

--
Deborah Pate (TeamB) http://delphi-jedi.org

TeamB don't see posts sent via Google or ISPs
Use the real Borland server: newsgroups.borland.com
http://www.borland.com/newsgroups/genl_faqs.html





Back to top
Deborah Pate (TeamB)
Guest





PostPosted: Wed Nov 19, 2003 12:21 pm    Post subject: Re: Import type library, Delphi 6, generation of PAS file fa Reply with quote

< which seems to work, but still I am not sure whether it is
as it should be.
Quote:


It looks fine.

--
Deborah Pate (TeamB) http://delphi-jedi.org

TeamB don't see posts sent via Google or ISPs
Use the real Borland server: newsgroups.borland.com
http://www.borland.com/newsgroups/genl_faqs.html



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi ActiveX Controls Usage All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.