DirectDraw interface

I want to use DirectDraw7. I include DDRAW.H and add a DDRAW.LIB to Win32Project. My code is:

LPDIRECTDRAW lpdd=NULL;

LPDIRECTDRAW lpdd7=NULL;

DirectDrawCreate(NULL, &lpdd, NULL);

lpdd->QueryInterface(IID_IDirectDraw7, (LPVOID*)lpdd7);

And there is a error:

Error 4 error LNK2001: unresolved external symbol _IID_IDirectDraw7 DDraw_Using.obj

Why i have this error IID_IDirectDraw7 is defind in ddraw.h. I using DXSDK 8.1. Thanks.



Answer this question

DirectDraw interface

  • jim_slc

    1. You're using an old DXSDK version. This bug may have been fixed in a later edition of the SDK. Upgrade your DXSDK.
    2. These forums are for Visual C++ 2005 only. Posts for VC6 or even VC2003 are off topic.
    3. For posts related to DirectX, you should consult the other forums, such as the DirectX forums, or the newsgroups.
    4. DirectDraw is no longer supported. New code shouldn't be using it. If you do use DirectDraw, you're on your own when it comes to errors like these.
    5. lpdd->QueryInterface(IID_IDirectDraw7, (LPVOID*)lpdd7);
      Won't work, because the second parameter expects to take in a void**, which is not lpdd7 is (it only has one indirection). The reason it needs to be a void **, is because it is an out parameter which will hold the pointer to the new interface. Better code would be:
      lpdd->QueryInterface(IID_IDirectDraw7, (LPVOID*)&lpdd7);
    6. Instead of using the raw interfaces, you should wrap the interfaces in a smart pointer. You get a smart pointer class for free with comdef.h:
  • T-oha

    OK. this is not actual already. I was need to write #define INITGUID

    :)))


  • DirectDraw interface