Various DirectX questions

This is a discussion on Various DirectX questions within the Game Programming forums, part of the General Programming Boards category; This is what it says on MSDN, for changing display modes in DirectX 7: ddrval = lpDD->SetDisplayMode(640, 480, 8); I ...

  1. #1
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879

    Various DirectX questions

    This is what it says on MSDN, for changing display modes in DirectX 7:
    ddrval = lpDD->SetDisplayMode(640, 480, 8);
    I stuck that into my compiler, and it spat out an error, something along the lines of "SetDisplayMode() doesn't take 3 parameters". I looked it up on my MSVC help, and it said that it took 5 parameters, except that it was "IDirectDraw2::SetDisplayMode()". It fixed when I used 5 parameters, but the IDirectDraw2 looks bad. Is there anything wrong with what I'm doing?

    This is another bit of code of mine:
    Code:
    DirectDrawCreateEx(NULL, (void**)&ddraw, IID_IDirectDraw7, NULL)
    On MSDN, it says that if I put anything other than IID_IDirectDraw7, it will choke and die. But my linker choked and died anyways It says that "_IID_IDirectDraw7" is an "unresolved external symbol". Am I forgetting a header or something? I have ddraw.h included.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    SetDisplayMode does in fact take 5 parameters in DirectX 7.0. Perhaps you were looking at an earlier SDK Help?

    As far as the IID_IDirectDraw7, you are not linking to a necessary file. Try adding "dxguid.lib" to your link path. This will fix the problem. Explanation:

    You must link to this library. It defines all of the Globally unique identifiers ( GUIDs ) for the DirectX Foundation COM interfaces. An alternative to linking to that file, you can put

    Code:
    #define INITGUID
    prior to all of your other includes. Hope this helps!
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Hmm, not sure how old the help was, but it was in MSDN's "archives", since DirectX8 already came out.

    But what would #define INITGUID do? Wouldn't I still need the library for the GUID definitions?
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    I'm not 100% on this but here is what I think. If you use the INITGUID , it will use pre-defined choices. If you link to the library however, I think it will generate a new one. Again, I'm not sure about this, I personally never use INITGUID , I just like to the library.

  5. #5
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    If you use the INITGUID , it will use pre-defined choices. If you link to the library however, I think it will generate a new one
    You mean you think it will:

    a) use pre-defined GUID's if you use INITGUID
    b) generate a totally new GUID if you include the library

    Am I right?
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  6. #6
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Yes, that is what I think.

    Again, everyone I know who writes DirectX games seems to just link to the library.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  7. #7
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Alright, thanks a lot

    P.S. Well, it is called "dxguid.lib"
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Directx questions
    By lruc in forum Game Programming
    Replies: 8
    Last Post: 07-07-2011, 11:26 PM
  2. 3 DirectX questions
    By MadCow257 in forum Game Programming
    Replies: 4
    Last Post: 03-07-2005, 01:47 PM
  3. 2 questions in DirectX
    By X PaYnE X in forum Game Programming
    Replies: 4
    Last Post: 12-02-2004, 09:38 AM
  4. A Few questions, DirectX
    By St0rmTroop3er in forum Game Programming
    Replies: 1
    Last Post: 09-26-2003, 07:28 PM
  5. newb-ish DirectX questions
    By confuted in forum Game Programming
    Replies: 4
    Last Post: 07-06-2003, 09:14 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21