Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Learning DirectPlay

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
6 replies to this topic

#1 Ratman   Members   

181
Like
Likes
Like

Posted 09 April 2000 - 04:36 AM

Im trying to learn directplay with the tutorial here on gamedev, and the directx helpfile. But the code is already not working (compiling). heres whats wrong: if(CoCreateInstance(CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, IID_IDirectPlay3A ,(LPVOID*)&lpdp ) != S_OK) { ErrorMessage("Error creating Directplay object"); CoUninitialize(); return; } // creating lobby object DirectPlayLobbyCreate(NULL, &lpdp, NULL, NULL, 0); // get new interface of lobby lpdp->QueryInterface(LPDIRECTPLAYLOBBY2A, (LPVOID *)&lpdplobby); //error C2275: ''LPDIRECTPLAYLOBBY2'' : illegal use of this type as an expression lpdp->Release(); I get errors with QueryInterface... any ideas? thanks dave ratti

#2 Kylotan   Moderators   

8817
Like
Likes
Like

Posted 09 April 2000 - 08:05 AM

<disclaimer>I have never used DirectPlay.</disclaimer>

quote:
Original post by Ratman

// get new interface of lobby

lpdp->QueryInterface(LPDIRECTPLAYLOBBY2A, (LPVOID *)&lpdplobby); //error C2275: ''LPDIRECTPLAYLOBBY2'' : illegal use of this type as an expression



You have passed ''LPDIRECTPLAYLOBBY2A'' to QueryInterface. This is not valid, as ''LPDIRECTPLAYLOBBY2A'' is a typename (ie. just like int, or char). You need to pass an object of that type, not the type itself.

Also (and I am not at all sure about this), you are using the same pointer (lpdp) for your DirectPlay interface -and- your DirectPlayLobby interface. I believe you need a different pointer as they are not the same thing. Maybe someone with more experience than I can point out what t do here.

#3 Void   Members   

126
Like
Likes
Like

Posted 09 April 2000 - 03:06 PM

It is perfectly fine to use the LPDIRECTPLAYLOBBY2A

but your problem is you are using the directplay pointer (LPDIRECTPLAY3A) instead of the directplay LOBBY pointer (LPDIRECTPLAYLOBBY2A) to query..

Check out the DirectX section. There is a directplay tutorial I have written before.

#4 Hotstone   Members   

133
Like
Likes
Like

Posted 09 April 2000 - 09:44 PM

I don''t know much about DirectPlay either, but this is a COM problem after all, isn''t it?

How can it be fine to use a type there? How does the compiler pass a type as a parameter of a function? And, to boot, the error message explicitly states that''s he''s "illegally using a type as an expression".

Anyway, the first parameter of the QueryInterface is an "interface ID" (that''s what they''re called isn''t it?). These usually start with "IID_". E.g., in DirectDraw: IID_IDirectDrawSurface, etc.

So he should try:

lpdp->QueryInterface( IID_IDirectPlayLobby2A, (LPVOID *)&lpdplobby);

Well, try that and see how you go, anyway.

-Hotstone



#5 Ratman   Members   

181
Like
Likes
Like

Posted 10 April 2000 - 12:04 AM

Void:

that code is copied directly from your tutorial. There were a few other errors to....

#6 Void   Members   

126
Like
Likes
Like

Posted 10 April 2000 - 02:15 PM

Hotstone is right..

I must be sleeping while typing that up..

Sorry about that.. I will go back and check for errors and post an updated copy..

#7 Void   Members   

126
Like
Likes
Like

Posted 11 April 2000 - 05:40 PM

Ok.. I have checked and ask gamedev to update the errors.

So far there are two errors reported..

I have checked and there doesn''t seem to be more.. but then my eyes are really tired..zz..

Please inform me if there are more errors.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.