Members - Reputation: 181
Posted 09 April 2000 - 04:36 AM
Moderators - Reputation: 3338
Posted 09 April 2000 - 08:05 AM
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.
Members - Reputation: 126
Posted 09 April 2000 - 03:06 PM
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.
Members - Reputation: 133
Posted 09 April 2000 - 09:44 PM
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.