[racket] Com Service with ffi
At Thu, 11 Oct 2012 11:28:19 +0200, heraklea at gmx.de wrote:
> So far so good:
> (define _ULONG _ulong)
> (define _CATID _GUID)
> (define _REFCATID _GUID-pointer)
> (define-cstruct _CATEGORYINFO ( [catid _CATID]
> [lcid _LCID]
> [szDescription (_array _short 128)]))
> (define IID_ICustomList
> (string->iid "{3039E12D-6CEF-4F91-AE9B-E609481C8824}"))
> (define CustomList (com-create-instance "MySrv.CustomList.1"))
>
> (define-com-interface (_ICustomList _IUnknown)
> ([Next/ci (_mfun (_ULONG = 1)
> (catinfo : (_ptr o _CATEGORYINFO))
> (got : (_ptr o _ULONG))
> -> (r : _HRESULT)
> -> (cond
> [(zero? r) catinfo]
> [(= r 1) #f]
> [else (windows-error "Next/ci
> failed" r)]))]
> [Skip _fpointer]
> [Reset _fpointer]
> [Clone _fpointer]))
>
> (define icat (QueryInterface (com-object-get-iunknown CustomList)
> IID_ICustomList
> _ICustomList-pointer))
>
> But I dont understand your third suggestion. lets assume my Interface have a
> method CallMe(...). How do I implement it and call it after.
>
> I assume you mean this part:
> (define-com-interface (_ICatInformation _IUnknown)
> ([EnumCategories (_hmfun _LCID
> (p : (_ptr o _IEnumCATEGORYINFO-pointer))
> -> EnumCategories p)]
>
>
> with EnumCategories as method??
Yes, `EnumCategories' is an example of a method. You will need to have
a `CallMe' method declared in some `define-com-interface' declaration
for `_ISomething', and then you invoke the `CallMe' method by applying
`CallMe' to an `_ISomething-pointer' value followed by arguments to the
method.
(Sorry for the delay -- hope this is still soon enough to be useful.)