🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

enumdevicescallback part of class?

Started by
12 comments, last by AlexM 24 years, 7 months ago
Well I'll be damned! Way to go!
------------------------
E.N.D. - http://listen.to/evil
Advertisement
woa!
thanks a bunch for the replies!
now i want to make the EnumDevices callback part of the class, but when i do that it says "can't convert an overloaded function to (_stdcall)(bla bla)". i'm not very good with classes, but first of all, i didn't overload it and secondly, i just don't see why it won't work:

HRESULT CALLBACK SD3d::EnumDevicesCallback(LPSTR lpDescription,LPSTR lpName,LPD3DDEVICEDESC7 lpd3ddd,LPVOID lparg)
{
//code here
return D3DENUMRET_OK;
}

bool SD3d::Setup(LPDIRECTDRAW7 lpdd,LPDIRECT3D7 lpd3d,HWND hWnd3d)
{
if (FAILED(lpd3d->EnumDevices((LPD3DENUMDEVICESCALLBACK7)this->EnumDevicesCallback,NULL)))
{
return false;
}
return true;
}

Thanks!
Alex.

Umm... very cool!

I would use it except I'm pretty sure that its non-portable and compiler-specific, since Microsoft wrote the CRT and the compiler.

Hell, you could put a main() function in there as well because in Windows main() is also not the real entry point.

But still, very cool. If you think that the WinMain belongs in a class, then it can and should be done!

- Splat

This topic is closed to new replies.

Advertisement