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 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