Re: Can this be automation compatible?



You are correct, this method is not Automation-compatible,
hence not permissible in a dual interface. It needs to be
rewritten with safe arrays. Alas, some people violate rules
left and right. In this case, the interface is probably marshaled
using a proxy/stub DLL (it cannot be marshaled via the type
library and the Automation marshaler). If done properly,
this interface should derive from IUnknown, not be marked
as dual, and it cannot be the Automation interface of an ActiveX
Control.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@xxxxxxxx
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

"John Carlyle-Clarke" <john.cc@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:Xns969A74EF3AC2johncceuroplacercouk@xxxxxxxxxxxxxxx
> I'm looking at a question someone has asked in a Delphi forum, and I
> realise that I'm uncertain about some pretty fundamental aspects of
> OLE/COM.
>
> His question refers to using a third party control's interface. It
> looks to me like method cannot be automation compatible, and yet
> according to his question it's part of a dual interface.
>
> How can this be?
>
> I thought the only way to pass an array in an automation context was
> with a safearray. I can see that these calls would maybe work in a
> DLL, if the COM system allows passing of pointers at all. But this
> surely could not work across machine or process boundaries, as how
> would the marhsaller know how big the arrays are? Or am I missing
> something?
>
> Here is the function prototype in C++:
>
> IRmNvCtrlDvd::GetDvdVolumeInfo
> Returns information about the DVD Volume being played
>
> Syntax
>
> HRESULT GetDvdVolumeInfo (
> INT* lpTitles,
> WORD* *Chapters,
> UNSIGNED CHAR** Angles
> );
>
> Parameters
>
> lpTitles [out] Pointer to the number of titles in the DVD
> volume.
>
> Chapters [out] Pointer to an array of chapters per title. The
> array indexes to be considered go from 1 to the number of available
> titles. This parameter can be NULL if not required.
>
> Angles [out] Pointer to an array of angles per title. The
> array
> indexes to be considered go from 1 to the number of available
> titles. This parameter can be NULL if not required.
>


.



Relevant Pages

  • Re: Conformant IDL array trouble
    ... I'm trying to send an array of structs ... array inside the struct gets marshalled. ... I'm not trying to be automation compatible ... and I've registered and built the proxy/stub for the interface. ...
    (microsoft.public.win32.programmer.ole)
  • Re: passing a NULL pointer from vb6 to an ATL method
    ... COBJINTERFACES and use the C macro for calling into the interface. ... local/call_as is necessary fior marshaling. ... Dim array as Double ... Then you need to write two shim functions in C to link with the ...
    (microsoft.public.vc.atl)
  • Re: Software feature set for automation
    ... > Quoting from the article "Home Automation: If you provide it will they ... distribute any media to any media center. ... flash driven interface would be cool. ... everything from recorded TV programs to security system to lighting. ...
    (comp.home.automation)
  • Re: Anders Hejlsberg comment on immutable objects
    ... > example of a situation where a read interface does help out. ... > able to read the byte array, ... > and trust the server method, you simply pass the full blown object. ... what is a violation of a const contract. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: .NET and COM Interop
    ... > I added a function that sets the array and it worked, ... To implement the interface properly you have to be a bit sneaky. ... try to implement the property properly, the compiler will complain. ... AssemblyInfo file whereas C# does not. ...
    (microsoft.public.dotnet.framework.interop)