Skip to main content
gamedev.net
🔒 Locked

DDraw device enumerating problem

Started by Xeno 12 replies 900+ views
Original Post
Xeno
Xeno
Hi all!. ok , here is my question: im trying to define my function to enumerate for directdraw devices , its looks like that: bool WINAPI DDEnumCallbackEx(GUID FAR *lpGUID, LPSTR lpDriverDescraption, LPSTR lpDriverName, LPVOID lpContext, HMONITOR hm); and im calling to this function with this code: HRESULT CEnumerate::EnumerateDevices(DD_DEVICE_INFO *DDDeviceInfo) { HRESULT hRet; hRet = DirectDrawEnumerateEx(DDEnumCallbackEx,NULL, DDENUM_ATTACHEDSECONDARYDEVICES // DDENUM_DETACHEDSECONDARYDEVICES // DDENUM_NONDISPLAYDEVICES); return hRet; } when i trying to compile my project i get this error: "c:\vsdxwlib\cenum.cpp(32) : error C2664: ''DirectDrawEnumerateExA'' : cannot convert parameter 1 from ''bool (struct _GUID *,char *,char *,void *,struct HMONITOR__ *)'' to ''int (__stdcall *)(struct _GUID *,char *,char *,void *,struct HMONITOR__ *)'' None of the functions with this name in scope match the target type" somebody know why? thanks a lot Posted By Xeno. Kobe Bryant - "Just believe in yourself" Visit my web site : VSoft
------------------------------- Goblineye Entertainment------------------------------
Don Bishop
Don Bishop
Just change the ''bool'' to ''BOOL''.

(A bool is 8-bits big in VC, and BOOL is 32-bits, so a BOOL is the same as an int, where a bool isn''t)
Xeno
Xeno
i did it.... no, still got the error.

i think its something with that: "(__stdcall *)" , its the only part that not the same between the two functions that displayed in the error massege,
somebody know what its mean?

Posted By Xeno.
Kobe Bryant - "Just believe in yourself"

Visit my web site : VSoft

Edited by - Xeno on June 26, 2000 4:08:24 PM
------------------------------- Goblineye Entertainment------------------------------
bstach
bstach
Changing from a return type bool to a return type BOOL should have worked. Except for your lower case bool, your callback function declaration looks virtualy identical to the one I am using and mine compiles fine. Strange...
risingdragon3
risingdragon3
A shot into the dark here....
I too got this error, when I was using classes to encapsulate the DDraw enumeration. However from what I see, the compiler doesn''t like the declaration.:

BOOL WINAPI DDEnumCallbackEx(GUID FAR *lpGUID,
LPSTR lpDriverDescraption,
LPSTR lpDriverName,
LPVOID lpContext,
HMONITOR hm);
[\code]
WINAPI should expand to __stdcall, it does with my borland compiler. Try changing the WINAPI to __stdcall.
[code]
BOOL __stdcall DDEnumCallbackEx(GUID FAR *lpGUID,
LPSTR lpDriverDescraption,
LPSTR lpDriverName,
LPVOID lpContext,
HMONITOR hm);
[\code]

Maybe it''s just a quirk of the MS compiler?

C++Freak.
risingdragon3
risingdragon3
*&@#%^
How the hell do you get that nice white code textbox? Sorry about the formating of the above post..
C++freal
Xeno
Xeno

nope , still got this error...
ahhh its start to crack me off ,


Posted By Xeno.
Kobe Bryant - "Just believe in yourself"

Visit my web site : VSoft
------------------------------- Goblineye Entertainment------------------------------
Xeno
Xeno
Someone ?
please help.

Thanks.
------------------------------- Goblineye Entertainment------------------------------
CMN
CMN
I don''t know, but I have found out that it sometimes helps to typecast callback pointers.

So you could try:
DirectDrawEnumerateEx((LPDDENUMCALLBACKEX)DDEnumCallbackEx, ...)

I really don''t think that this will solve your problem, but it can''t hurt to try

/CMN

Xeno
Xeno
still not working.....
ahhhhhhhhh
somebody know new ideas?

thanks

Posted By Xeno.
Kobe Bryant - "Just believe in yourself"

Visit my web site : VSoft
------------------------------- Goblineye Entertainment------------------------------
Gandalf
Gandalf
Maybe make the callback function static?


static bool WINAPI DDEnumCallbackEx(GUID FAR *lpGUID,
LPSTR lpDriverDescraption,
LPSTR lpDriverName,
LPVOID lpContext,
HMONITOR hm);


Gandalf the White



Edited by - Gandalf on June 27, 2000 5:52:02 AM
Gandalf the Black
Xeno
Xeno
Wow ,Gandalf its worked
Thanks a lot!.

but still im wondering , because i saw it working without "static" , in one of the SDK samples
its strange .

Posted By Xeno.
Kobe Bryant - "Just believe in yourself"

Visit my web site : VSoft
------------------------------- Goblineye Entertainment------------------------------
CMN
CMN
Just after posting my last replay I actually had the same problem myself, with EnumZBufferFormats, and when I typecasted the enumeration callback pointer with LPD3DENUMZBUFFERSCALLBACK (or whatever) it worked. So don''t go around thinking that I''m mental or anything

Xeno
Xeno
why do u think that i thinking u mental or anything ??
u just tried to help and for some reason (that really crack me off :p) for u its worked and for me not.

well, at least it working now , when i declare on the function as a static function.

Posted By Xeno.
Kobe Bryant - "Just believe in yourself"

Visit my web site : VSoft
------------------------------- Goblineye Entertainment------------------------------

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.