News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Direct2D problems

Started by zemtex, January 29, 2011, 05:43:46 AM

Previous topic - Next topic

zemtex

Hi.

I've coded a basic direct3d application and it works fine. I want to try get a Direct2D app working, but my application crashes when I try to create a factory.

Here is the function to create the factory, can anyone tell me what I am doing wrong here:

CreateFactory proc

   ; Factory Interface
   push OFFSET FactoryInterface

   ; Single threading
   push D2D1_FACTORY_TYPE_SINGLE_THREADED

   call dword ptr [ProcAddress1]   ; Procaddress 1 is the address to D2D1CreateFactory in d2d1.dll (which is in the system32 folder)
   
   ret
   
CreateFactory endp



Here is how microsoft and others do it in c++:

hr=D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &pD2DFactory)
I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.

zemtex

I changed it to this, now it doesnt crash anymore. Gonna have to try further to see if it has been done right.

   ; Factory Pointer
   push OFFSET FactoryInterface

   ; Push debugging settings
   push D2D1_DEBUG_LEVEL_NONE

   ; Push riid
   push OFFSET riid
   
   ; Single threading
   push D2D1_FACTORY_TYPE_SINGLE_THREADED

   ; Call method
   call dword ptr [ProcAddress1]
   
   ret

I have been puzzling with lego bricks all my life. I know how to do this. When Peter, at age 6 is competing with me, I find it extremely neccessary to show him that I can puzzle bricks better than him, because he is so damn talented that all that is called rational has gone haywire.