Archived

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

Noodles

problem with callback

Recommended Posts

hi, i have a class which does all my graphics in the app im developing. in its init function the following code poses problems when i try to enumerate directdraw devices: //... DirectDrawEnumerateEx(EnumDirectDrawCallback, NULL, DENUM_ATTACHEDSECONDARYDEVICES | DDENUM_DETACHEDSECONDARYDEVICES |DDENUM_NONDISPLAYDEVICES ); //... EnumDirectDrawCallback is a static member function of the graphics class declared as follows: static BOOL CALLBACK EnumDirectDrawCallback(GUID*, char*, void*, HMONITOR); whether I put WINAPI, PASCAL or even __stdcall, the compiler still thinks this function is of type __cdecl? can anibody tell me what the heck is going on? thanks

Share this post


Link to post
Share on other sites
I am not sure what is causing the error. Make sure that when you declare a static member function, you only use the "static" keyword when declaring it.

Example:

class myclass
{
public:
static bool CALLBACK function(/*parameters*/);
};
 
// note the absence of "static" here
bool CALLBACK myclass::function(/*parameters*/)
{
// ...
}

Share this post


Link to post
Share on other sites