[racket] Com Service with ffi
At Wed, 10 Oct 2012 14:33:41 +0200, heraklea at gmx.de wrote:
> Ok,
>
> I make this:
>
> (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-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]))
>
>
> But I dont know how to use it, especially in invoking the desired function??
The `show-all-classes' part of the example illustrates how:
* create an instance of some COM class using `com-create-instance'
* get an interface-specific reference using `QueryInterface'
* apply a method as a function with the reference as its first argument,
like the call to `EnumCategories'.