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


Initialising Direct Draw 7

Recommended Posts

Hi im trying to understand the creation of a Direct Draw Com object and ive been using Teej''s Tetris Tutorial forum which is excellent but unfortunately isnt being updated anymore. So im going to have to ask for help here. I understand the need to create a com object and the use of its interfaces etc but i dont understand the first step of creating one. Teejs tutorial and loads of others state something like this As quoted from the tutorial: The main COM interface for DirectDraw is called IdirectDraw7. Note that we’re using DirectX 7.0 components in this tutorial, so the first line asks for this interface: // Create our DirectDraw object hRet = DirectDrawCreateEx(NULL, (void**)&G.lpDD, IID_IDirectDraw7, NULL); if (FAILED(hRet)) return -1; Here’s the prototype for this function: extern HRESULT WINAPI DirectDrawCreateEx( GUID FAR * lpGuid, LPVOID *lplpDD, REFIID iid,IUnknown FAR *pUnkOuter ); OK SO FAR SO GOOD. I understand the pointer to pointer business (second argument) but that understanding stops here when teej follows on with If you look in GLOBALS.H, here’s what we currently have for our DirectDraw object: LPDIRECTDRAW lpDD; As you can guess, this is a pointer already (we usually use ‘p’ or ‘lp’ to denote ‘pointer’). HANG ON A MINUTE.... is teej saying that lpDD is a pointer. If he is then where is the * notation whch is used to declare a pointer?? DirectDrawCreateEx asks for the address of a pointer which, if successful in initialising, points to the COM object. But teej supplies it with &lpDD which is the address of not a pointer but of a type LPDIRECTDRAW. Can anyone help me out on this one. I thought i had the pointer to pointer topic covered but it now seems im just as confused as anyone else on pointers.

Share this post

Link to post
Share on other sites