Recipe and best practice for accessing COM

newToCOM new at to.com
Sun Sep 2 12:51:13 PDT 2012


Thanks for your replies!

I'm trying to accomplish this:
http://msdn.microsoft.com/en-us/library/windows/apps/dd535473.aspx

Using win32 and directx.d2d1, I got this far:

---

...
int WinMain( ... ) { ... }
int myWinMain( ... ) { ... }
LRESULT WndProc ( ... )
{
     ...
     case WM_CREATE:
         D2D1_FACTORY_OPTIONS factoryOptions;
             factoryOptions.debugLevel = 
D2D1_DEBUG_LEVEL.INFORMATION;
         const D2D1_FACTORY_OPTIONS* pfactoryOptions = 
&factoryOptions;
         const IID factory = IID_ID2D1Factory;
         void* ppIFactory;

         HRESULT hr = D2D1CreateFactory(
                 D2D1_FACTORY_TYPE.SINGLE_THREADED,
                 &factory,
                 pfactoryOptions,
                 ppIFactory
                 );
     ...
}

---

I get the following error messages:
- 1 -
function win32.directx.d2d1.D2D1CreateFactory (
     D2D1_FACTORY_TYPE factoryType,
     const(GUID)* riid,
     const(D2D1_FACTORY_OPTIONS*) pFactoryOptions,
     out void* ppIFactory)
is not callable using argument types (
     D2D1_FACTORY_TYPE,
     const(GUID)*,
     const(D2D1_FACTORY_OPTIONS*),
     void*)

- 2 -
cannot implicitly convert expression (& factory)
of type const(GUID)* to const(GUID)*


How should this be done correctly?
How is a rectangle finally drawn?


More information about the Digitalmars-d-learn mailing list