The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: lonewolff on July 21, 2009, 11:56:04 AM

Title: Starting with DirectX - A couple of problems
Post by: lonewolff on July 21, 2009, 11:56:04 AM
Hi there,

Always experimenting I am  ::)

I have taken on a few challenges here to reach this problem. But, I am sure you guru's will be able to assist.

I have started playing around with creating my own inc files and what better way to experiment than using DirectX?  :lol

I have made the following include file which appears to be ok;

D3D_SDK_VERSION equ <32>

D3DDISPLAYMODE typedef DWORD
IDirect3D9 typedef DWORD

GetAdapterDisplayMode PROTO :DWORD,:DWORD
Direct3DCreate9 PROTO :DWORD
ExitProcess PROTO :DWORD


And my main project

.386
.model flat,stdcall
option casemap:none

includelib \masm32\lib\kernel32.lib
include directx.inc
includelib D3d9.lib

.data

.data?
md3dObject IDirect3D9 ?
mode D3DDISPLAYMODE ?

.code
start:

invoke Direct3DCreate9,D3D_SDK_VERSION
mov md3dObject,eax

;md3dObject->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&mode); // C++ code
coinvoke md3dObject,IDirect3D9,GetAdapterDisplayMode,D3DADAPTER_DEFAULT,ADDR mode

invoke ExitProcess,eax

end start


Everything compiles ok until I get to the 'coinvoke' line. Where I get a syntax error md3dObject. I can't figure out why I am getting this syntax error. Can anyone help guide me to where I have gone wrong?

Thanks in advance :)
Title: Re: Starting with DirectX - A couple of problems
Post by: lonewolff on July 22, 2009, 02:30:59 AM
Also, what does coninvoke do exactly?
Title: Re: Starting with DirectX - A couple of problems
Post by: UtillMasm on July 22, 2009, 05:31:06 AM
Error post
Title: Re: Starting with DirectX - A couple of problems
Post by: lonewolff on July 22, 2009, 05:45:47 AM
Hmmm, sorry. Not sure what you are getting at there  :red
Title: Re: Starting with DirectX - A couple of problems
Post by: ToutEnMasm on July 22, 2009, 07:03:38 AM
A sample to start is better
http://www.masm32.com/board/index.php?topic=7996.0 (//http://)
I have translated the six tutorials of directx 9.C.The last is meshes.
This samples seems to be improve now.
The translator is better now than when i write them,you can translate others with it and verify them.