Jump to content
  • Advertisement

Archived

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

Xeno

DDraw device enumerating problem

This topic is 6541 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

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

Share this post


Link to post
Share on other sites
Advertisement
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)

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
still not working.....
ahhhhhhhhh
somebody know new ideas?

thanks

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

Visit my web site : VSoft

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!