Board index » delphi » IEnumVariant in D5 was changed!!!

IEnumVariant in D5 was changed!!!

Hi,

just converted my first app from D4 to D5 and noticed something really
strange:

The declaration of IEnumVariant.Next was changed from

function Next(celt: Longint; out elt; pceltFetched: PLongint): HResult;
stdcall;

to

function Next(celt: LongWord; var rgvar : OleVariant; out pceltFetched:
LongWord): HResult; stdcall;

First: I was told that interface must not be changed once published! BTW:
the CLSID stayed the same!

I also noticed that the old interface is still available as IEnumVariant_D4,
but before using this I would like to know why this was changed as I can't
find any documentation on this. Don't want to use IEnumVariant_D4 before I
know why the changed was made. In the sources there is only something like
"..due to changes in the type library". Which one? STDVCL stayed the same
(40).

Hope somebody can help me out here...

Thanks

Sebastian Modersohn

 

Re:IEnumVariant in D5 was changed!!!


In article <7s112e$r...@forums.borland.com>,

Quote
Sebastian Modersohn <msohn[NOSPAM]@compuserve.com> wrote:
>Hi,

>just converted my first app from D4 to D5 and noticed something really
>strange:

>The declaration of IEnumVariant.Next was changed from

Yep.

IEnumVariant as defined in D4 was inconsistent with IEnumVariant
as defined in the windows header files. This was causing problems
for some people that were trying to use it in cross-language
development.

It was updated, but the previous one was kept for backwards
compatability.

[Note that IEnumVariant is a windows/com API interface.]
--
Caminante, son tus huellas el camino, y nada mas;
caminante, no hay camino, se hace camino al andar ...
Caminante, no hay camino, sino estelas en el mar.

Re:IEnumVariant in D5 was changed!!!


OK, thanks for the explanation. I'm using the unit supplied by Binh Ly (via
his COM homepage) where he implements TEnumVariantCollection.

The code looks something like this:

function TEnumVariantCollection.Next (celt: Longint; out elt; pceltFetched:
PLongint): HResult;
type
  TVariantList = array [0..0] of olevariant;
var
  i : integer;
begin
  i := 0;
  while (i < celt) and (FIndex < FCollection.GetCount) do
  begin
    TVariantList (elt) [i] := FCollection.GetItems (FIndex);
    inc (i);
    inc (FIndex);
  end;  { while }
  if (pceltFetched <> NIL) then
    pceltFetched^ := i;
  if (i = celt) then Result := S_OK else Result := S_FALSE;
end;

I'm failing in porting this code: first pceltFetched isn't a PLongInt
anymore but and "out LongWord". I've debugged the code and have seen that my
automation client calls in with a nil adress for pceltFetched! So how to
change the code above?

Any help would be greatly appreciated

Sebastian Modersohn

aphr...@magescave.blackforest.org schrieb in Nachricht
<7s16vo$t0...@rspitz.inprise.com>...

Quote
>In article <7s112e$r...@forums.borland.com>,
>Sebastian Modersohn <msohn[NOSPAM]@compuserve.com> wrote:
>>Hi,

>>just converted my first app from D4 to D5 and noticed something really
>>strange:

>>The declaration of IEnumVariant.Next was changed from

>Yep.

>IEnumVariant as defined in D4 was inconsistent with IEnumVariant
>as defined in the windows header files. This was causing problems
>for some people that were trying to use it in cross-language
>development.

>It was updated, but the previous one was kept for backwards
>compatability.

>[Note that IEnumVariant is a windows/com API interface.]
>--
>Caminante, son tus huellas el camino, y nada mas;
>caminante, no hay camino, se hace camino al andar ...
>Caminante, no hay camino, sino estelas en el mar.

Re:IEnumVariant in D5 was changed!!!


In article <7s17va$rn...@forums.borland.com>,

Quote
Sebastian Modersohn <msohn[NOSPAM]@compuserve.com> wrote:
>I'm failing in porting this code: first pceltFetched isn't a PLongInt
>anymore but and "out LongWord". I've debugged the code and have seen that my
>automation client calls in with a nil adress for pceltFetched! So how to
>change the code above?

Use IEnumVariant_D4. :)

It turns out the binary layouts are identical either way.

--
Caminante, son tus huellas el camino, y nada mas;
caminante, no hay camino, se hace camino al andar ...
Caminante, no hay camino, sino estelas en el mar.

Re:IEnumVariant in D5 was changed!!!


I've updated ComLib to compensate for the D5 change. You can redownload it
again at:

http://www.castle.net/~bly/files/ComLib.zip

have fun
--
Binh Ly
Visit my COM Notes at http://www.castle.net/~bly/com

Quote
Sebastian Modersohn <msohn[NOSPAM]@compuserve.com> wrote in message

news:7s17va$rnd10@forums.borland.com...
Quote
> OK, thanks for the explanation. I'm using the unit supplied by Binh Ly
(via
> his COM homepage) where he implements TEnumVariantCollection.

> The code looks something like this:

> function TEnumVariantCollection.Next (celt: Longint; out elt;
pceltFetched:
> PLongint): HResult;
> type
>   TVariantList = array [0..0] of olevariant;
> var
>   i : integer;
> begin
>   i := 0;
>   while (i < celt) and (FIndex < FCollection.GetCount) do
>   begin
>     TVariantList (elt) [i] := FCollection.GetItems (FIndex);
>     inc (i);
>     inc (FIndex);
>   end;  { while }
>   if (pceltFetched <> NIL) then
>     pceltFetched^ := i;
>   if (i = celt) then Result := S_OK else Result := S_FALSE;
> end;

> I'm failing in porting this code: first pceltFetched isn't a PLongInt
> anymore but and "out LongWord". I've debugged the code and have seen that
my
> automation client calls in with a nil adress for pceltFetched! So how to
> change the code above?

> Any help would be greatly appreciated

> Sebastian Modersohn

> aphr...@magescave.blackforest.org schrieb in Nachricht
> <7s16vo$t0...@rspitz.inprise.com>...
> >In article <7s112e$r...@forums.borland.com>,
> >Sebastian Modersohn <msohn[NOSPAM]@compuserve.com> wrote:
> >>Hi,

> >>just converted my first app from D4 to D5 and noticed something really
> >>strange:

> >>The declaration of IEnumVariant.Next was changed from

> >Yep.

> >IEnumVariant as defined in D4 was inconsistent with IEnumVariant
> >as defined in the windows header files. This was causing problems
> >for some people that were trying to use it in cross-language
> >development.

> >It was updated, but the previous one was kept for backwards
> >compatability.

> >[Note that IEnumVariant is a windows/com API interface.]
> >--
> >Caminante, son tus huellas el camino, y nada mas;
> >caminante, no hay camino, se hace camino al andar ...
> >Caminante, no hay camino, sino estelas en el mar.

Re:IEnumVariant in D5 was changed!!!


Quote
>Use IEnumVariant_D4. :)

Well easy said, but can't be done ... Method Clone of IEnumVariant_D4 takes
an IEnumVariant parameter! Seems somebody made that q&d and nobody tested
it!
I redeclared IEnumVariant the old way locally and that worked finally.
Anyway I'm not really satisfied with this...

Quote
>It turns out the binary layouts are identical either way.

Can't understand this. Actually it should have a different stack! Anyway...

Thanks for your help

Sebastian

Re:IEnumVariant in D5 was changed!!!


Quote
>I've updated ComLib to compensate for the D5 change. You can redownload it
>again at:

Oh thank you for the great service! That's what I was waiting for in my
dreams... ;->

Keep up the good work!

Sebastian

Other Threads