Public Group

Archived

This topic is now archived and is closed to further replies.

Obtaining a DirectDraw4 Interface

This topic is 5615 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

**I dunno if this should go in the DirectX forum or not, but since it's such a newbie question, I decided to put it here I'm trying to get back into DirectDraw after a long break from it, but now I have a new problem -- I can't request a DirectDraw4 interface. Using the code (noting the fact that there were some errors) from TOWGPG, I tried to make myself a class (a wrapper?) to make DDraw init painless. Upon compiling, I got 7 errors, all related to DirectDraw4:

c:\developer\directdrawbeginningtest\ddrawclass.h(15) : error C2146: syntax error : missing ';' before identifier 'lpdd4'
c:\developer\directdrawbeginningtest\ddrawclass.h(15) : error C2501: 'LPDIRECTDRAW4' : missing storage-class or type specifiers
c:\developer\directdrawbeginningtest\ddrawclass.h(15) : error C2501: 'lpdd4' : missing storage-class or type specifiers
c:\developer\directdrawbeginningtest\ddrawclass.h(23) : error C2065: 'lpdd4' : undeclared identifier
c:\developer\directdrawbeginningtest\ddrawclass.h(36) : error C2065: 'IID_IDirectDraw4' : undeclared identifier
c:\developer\directdrawbeginningtest\ddrawclass.h(41) : error C2227: left of '->SetCooperativeLevel' must point to class/struct/union
c:\developer\directdrawbeginningtest\ddrawclass.h(46) : error C2227: left of '->SetDisplayMode' must point to class/struct/union

I even tried code that worked on my other computer a while back and tried to compile on this one (including ddraw.lib and dxguid.lib), but no luck. I can think of only three possiblities: 1. This is a fairly new computer, and never had earlier versions of DirectX. Might I need to download an older SDK? 2. I'm running WinXP. Any compatability problems here with DirectDraw? 3. DirectDraw is no longer supported (ie: it won't work anymore, since the new version is out) I'm pretty sure this isn't it though. Anyone else have some insight into why this is happening? Peon [edited by - Peon on March 2, 2003 9:46:15 PM] [edited by - Peon on March 2, 2003 9:47:05 PM]

Share on other sites
most of the time (from my knowledge) DirectX SDK''s are backwards compatiable for development using older technologies. This isn''t the case all the time though, considering that in newer versions some functions or methods are replaced with more functional counterparts. im not extremely familiar with directdraw4, i would consider 7, it may be old(er) than Direct X Graphics, but any computer that is worth its money has that version. Is it possible that you forgot to #include <ddraw.h>,.... ive done that before. if its possible, set up your IDE so you can search for definitions of those interfaces. when ive got those errors concerning directdraw7, it was a link error of some kind. it is possible that despite backwards compatabilty, the SDK you are using no longer uses DirectDraw4 interfaces, and therefore cant identify it. i suggest browsing through the files you are including and looking for said interface declarations. and if possible, move to a (more) recent techonolgy that is directdraw7. i find direct3d overkill, although not too complicated due to the ID3DXSprite interface. so maybe directx 8 is right for you too. but either way, its more than likely a link error.

----------------------
i code therefore i am.

Aero DX - Coming to a bored Monitor near you!

Share on other sites
The DirectDraw4 Interface is from DirectX6 I believe (TOTWGPG is a dated book ) Why MS decided not to name the interface according to the version of DirectX is beyond me, but whatever

is definetly included.

I looked @ the actual ddraw.h source and noticed in it there is no DirectDraw4 interface... I saw just a plain DirectDraw (LPDIRECTDRAW), and a DirectDraw2 (LPDIRECTDRAW2), but no DirectDraw4. Strange. I know it worked in the past, at least on my older computer. I'll have to take a look at my old version of ddraw.h and see how it compares.

I'm tempted to just go ahead and jump into 3D, but I think I'm really lacking in some of the concepts.

EDIT: Bingo. Found this in my old DDraw.h--

I'm tempted to just save the old one over the new, but I'm a little worried (I'll probably just back up just in case) Could the difference be do to the fact that this machine never had anything less than DirectDraw 8?

Peon

[edited by - Peon on March 2, 2003 11:05:05 PM]

Share on other sites
quote:
TOTWGPG is a dated book

Theres a second edition...that covers sdk 8.0...dated but not as dated... :-p

Share on other sites
Although the RUNTIME for directx is backward compatible, the SDKs are usually not.

Meaning that you will have to hunt down the appropriate SDK and install it.

I think the first edition of the Windows Gurus book has that sdk on the cd.

Share on other sites
quote:

I''m tempted to just save the old one over the new, but I''m a little worried (I''ll probably just back up just in case) Could the difference be do to the fact that this machine never had anything less than DirectDraw 8?

i think you meant DirectX 8. there is no such thing as directdraw8, only direct x graphics. as far as writing over your ddraw.h.... be careful... the ddraw.ccp would not be compatable because of the different functions and whatnot. it may be hard to find, but you can get the directx7 sdk on microsoft.com, i know i did a couple of weeks ago.

----------------------
i code therefore i am.

Aero DX - Coming to a bored Monitor near you!

Share on other sites
I''m sure I have the ddraw.cpp too (that goes with my old ddraw.h) but yeah, like I said, I need to make sure to back it up. I''ll probably end up looking for the SDK instead. Would it interfere with an existing DirectX8 SDK (I think I did install the DX8 SDK, at some point)

Share on other sites
i''m a bit of a n00b but can''t you just define the directx version to be something else? AFAIK the SDKs are backwards compatible (you can still use the DDraw7 in DX8 if you define the SDK version to be 7).

__________________________________________
you just think i''m here. i''m really not.

Share on other sites
it wont conflict, just make sure you unlink the DX 8 sdk before linking your compiler to another version. keep the sdks in seperate folders.

----------------------
i code therefore i am.

Aero DX - Coming to a bored Monitor near you!

Share on other sites
Mmm... well, I downloaded the DirectX 9 SDK (after trying to do the DX6 one) and it does work now... but I still have problems; this time it is with SetDisplayMode (currently returning DDERR_UNSUPPORTED). I will post my code just once to see if anyone has an idea of what''s wrong, otherwise I may just give up and just start anew with DirectX9

  class cDirectDraw{public:	cDirectDraw(HWND hwnd);      //default constructor 	void init();        //initalization procedureprivate:	HWND myWindow;       //handle to the main window	LPDIRECTDRAW lpdd;  //used to hold initial interface	LPDIRECTDRAW4 lpdd4; //use d to hold the interface we will use};cDirectDraw::cDirectDraw(HWND hwnd){	//set all the initial objects to NULL	lpdd  = NULL;	lpdd4 = NULL;	//grab the handle to the window and copy it	myWindow = hwnd;};void cDirectDraw::init(){	if (FAILED(DirectDrawCreate(NULL, &lpdd, NULL)))	{		MessageBox(NULL, "Direct Draw Interface cannot be retrieved!", "DirectDraw error", MB_OK);	}//endif	if (FAILED(lpdd->QueryInterface(IID_IDirectDraw4, (LPVOID *)&lpdd4)))	{		MessageBox(NULL, "Cannot obtain DirectDraw 4 object!", "DirectDraw Error", MB_OK);	}//end of	if (FAILED(lpdd4->SetCooperativeLevel(myWindow, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE)))	{		MessageBox(NULL, "Cannot set cooperative level!", "DirectDraw Error", MB_OK);	}//endif	//if (FAILED(lpdd4->SetDisplayMode(1024, 780, 8, 0, 0)))	if ((lpdd4->SetDisplayMode(800,640,32,0,0)) == DDERR_UNSUPPORTED)//I tried a bunch of errors returned from this function, and found out that it was returning DDERR_UNSUPPORTED	{		MessageBox(NULL, "Cannot set display mode!", "display Error", MB_OK);	}	//MessageBox(NULL, "success!", "success", MB_OK);h};

1. 1
Rutin
24
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 9
• 46
• 41
• 23
• 13
• Forum Statistics

• Total Topics
631749
• Total Posts
3002031
×