In my git repo (git://pgdn.org/factor) I just checked in a simple
interface I've been working on for calling out to COM objects. Check
out the windows.ole32, windows.com and windows.com.syntax vocabs for
the goods. In a nutshell:
--8<--
COM-INTERFACE: IUnknown f {00000000-0000-0000-C000-000000000046}
HRESULT QueryInterface ( REFGUID iid, void** ppvObject )
ULONG AddRef ( )
ULONG Release ( ) ;
: com-query-interface ( interface iid -- interface' )
f <void*>
[ IUnknown::QueryInterface ole32-error ] keep
*void* ;
COM-INTERFACE: IShellFolder IUnknown {000214E6-0000-0000-
C000-000000000046}
HRESULT ParseDisplayName ( HWND hwndOwner, void* pbcReserved,
LPOLESTR lpszDisplayName, ULONG* pchEaten, LPITEMIDLIST* ppidl, ULONG*
pdwAttributes )
HRESULT EnumObjects ( HWND hwndOwner, SHCONTF grfFlags,
IEnumIDList** ppenumIDList )
HRESULT BindToObject ( LPCITEMIDLIST pidl, void* pbcReserved,
REFGUID riid, void** ppvOut )
HRESULT BindToStorage ( LPCITEMIDLIST pidl, void* pbcReserved,
REFGUID riid, void** ppvObj )
HRESULT CompareIDs ( LPARAM lParam, LPCITEMIDLIST pidl1,
LPCITEMIDLIST pidl2 )
HRESULT CreateViewObject ( HWND hwndOwner, REFGUID riid, void**
ppvOut )
HRESULT GetAttributesOf ( UINT cidl, LPCITEMIDLIST* apidl,
SFGAOF* rgfInOut )
HRESULT GetUIObjectOf ( HWND hwndOwner, UINT cidl, LPCITEMIDLIST*
apidl, REFGUID riid, UINT* prgfInOut, void** ppvOut )
HRESULT GetDisplayNameOf ( LPCITEMIDLIST pidl, SHGDNF uFlags,
STRRET* lpName )
HRESULT SetNameOf ( HWND hwnd, LPCITEMIDLIST pidl, LPCOLESTR
lpszName, SHGDNF uFlags, LPITEMIDLIST* ppidlOut ) ;
FUNCTION: HRESULT SHGetDesktopFolder ( IShellFolder** ppshf ) ;
f <void*> [ SHGetDesktopFolder ole32-error ] keep *void* ! Get the
desktop folder COM object
IShellFolder-iid com-query-interface ! Ask for the
IShellFolder interface
[ f f "c:\\windows\\system32" string>u16-alien "ULONG" <c-object>
"ITEMIDLIST" <c-object> "ULONG" <c-object>
[ IShellFolder::ParseDisplayName ] 3keep ] with-com-interface
--8<--
I haven't done anything yet to handle implementing COM interfaces in
Factor, asidef from some hand-rolled code in the windows.com unit
tests that duct-tapes together a test COM class. That'll probably be
my next trick.
-Joe
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk