Archived

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

DirectX COM and C

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Damnit, i was hoping someone wouldnt say that :D, help files (Mostly DirectX) and i dont get along. Not that im lazy (well, now that i think about it, maybe so)

Ohh well, i guess i''ll sink my teeth into that DX help file once again

Share this post


Link to post
Share on other sites
You mean this:

lpDD->lpVtbl->CreateSurface (lpDD, &ddsd, &lpDDS,
NULL);

Here''s how the code looks in c++:

lpDD->CreateSurface(&ddsd, &lpDDS, NULL);

Notice the lpVtbl (the object''s vtable), and that the object (lpDD) is the first parameter of the method.

This is straight from the SDK help:

Introducing DirectX Foundation->C and C++ Programming Topics->The Component Object Model->Accessing COM Objects Using C.

+AA_970+

Share this post


Link to post
Share on other sites
There are also macros in the respective headers if you''re too lazy to remember vtbl all the time, or if you''re just weird; they look something like (ddraw release method here, but you get the idea):

DirectDraw_Release(i) (i)->lpVtbl->Release(i)

And each object should have a set of them



----------
meh

Share this post


Link to post
Share on other sites
#define RELEASE(DirectDraw) DirectDraw->lpVtbl->Release(DirectDraw)

also *ALWAYS* remember to pass the structure calling the method as the first parameter.



-----------------------------

A wise man once said "A person with half a clue is more dangerous than a person with or without one."

Edited by - ImmaGNUman on July 18, 2000 9:10:24 PM

Share this post


Link to post
Share on other sites