Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: DirectDraw in C

  1. #1
    EmuTalk Member
    Join Date
    Jul 2004
    Location
    Someplace where I don't know where I am.
    Posts
    618

    DirectDraw in C

    I've been trying for a while to get a simple DirectDraw program written in C to compile under MSVC++ 6.0. It refuses to compile this line:

    Code:
    DirectDrawCreateEx(NULL, &lpDD, IID_IDirectDraw7, NULL);
    It gives me the following errors:

    Code:
    directdraw.c(5) : error C2115: 'function' : incompatible types
    directdraw.c(5) : warning C4024: 'DirectDrawCreateEx' : different types for formal and actual parameter 3
    Any ideas?

    BTW, I've included ddraw.h, and I've added the ddraw.lib and dxguid.lib files.



    • Advertising

      advertising
      EmuTalk.net
      has no influence
      on the ads that
      are displayed
        
       

  2. #2
    Moderator smcd's Avatar
    Join Date
    Jun 2004
    Posts
    2,503
    I googled for "warning C4024: 'DirectDrawCreateEx' : different types for formal and actual parameter 3" without the quotes and got 2 results, both from gamedev.net, and both saying the below. Give it a try

    http://www.gamedev.net/community/for...topic_id=34452
    http://www.gamedev.net/community/for...topic_id=85221

    DirectDrawCreateEx(NULL, (VOID**)&lpDD, IID_IDirectDraw7, NULL); should be changed to:

    DirectDrawCreateEx(NULL, (VOID**)&lpDD, &IID_IDirectDraw7, NULL);

  3. #3
    EmuTalk Member
    Join Date
    Jul 2004
    Location
    Someplace where I don't know where I am.
    Posts
    618
    Thanks, seth. That is weird though. I swear to you I found both of the pages you just linked before, I tried exactly what they said and it refused to work. Yet when you suggested it just now and I tried it, it magically works. What's the deal O_o?

  4. #4
    Moderator smcd's Avatar
    Join Date
    Jun 2004
    Posts
    2,503
    Weird indeed, but glad it works now

  5. #5
    A lowdown dirty shame blueshogun96's Avatar
    Join Date
    Aug 2005
    Location
    Puyallup, WA
    Posts
    196
    Yeah, your problem was the fact that you didn't have a '&' in front of your GUID. I forgot why, but when you are using COM in C, you need to do that for EVERY GUID you use, not just with DirectDrawCreateEx, but also with IUnknown::QueryInterface. I am a die-hard, strait C, DirectDraw programmer myself, so I have had my fair share of this.
    This is me and my PC everyday

    Need a good tutorial on emu programming? Click here. (Link Updated)
    Dynarec article
    Misc emu programming tidbits

  6. #6
    EmuTalk Member Poobah's Avatar
    Join Date
    Feb 2004
    Posts
    475
    Would someone be able to post a guide of some sort that explains how to actually use Directdraw in C?
    My Site
    Batch-extract and re-archive individual ROMs from GoodMerged 7z archives into individual ZIP or JMA files. (Now a Windows GUI program!)

    Drug Free For Life: 98% of the teenage population has
    tried drugs at least once. If you are one of the 2%
    who hasn't, copy and paste this into your signature.

  7. #7
    EmuTalk Member
    Join Date
    Jul 2004
    Location
    Someplace where I don't know where I am.
    Posts
    618
    I've looked for a guide, but I have yet to find one. For the functions I've used so far, I had to make the pointer in front of the function the first argument in the parentheses and then add "IDirectDraw7_" where the pointer was.

    So, as far as I can tell:

    Code:
    lpDD->SetCooperativeLevel(hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
    Would become something like this in C:

    Code:
    IDirectDraw7_SetCooperativeLevel(lpDD, hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);

  8. #8
    ????????????????????????? Doomulation's Avatar
    Join Date
    Nov 2001
    Location
    ????????????????
    Posts
    8,780
    One question though:
    Why use C?
    Atashi wa juu-yon-sai no onna no ko! Atashi no namae wa Miizuki. Yurushiku ne!
    Nani? Atashi o shinjirimasen desu ka? Baka!
    "You're all doomed! Doomed, I say! Hehe... are we approaching the end of the world?"

    shikata ga kaite aru - "the instructions are written above"
    Need to download GoodN64 or instructions to use it? Need to check if it's a good or bad rom?
    Download: Glide64 | Hacktarux's wrapper

  9. #9
    Gekko Developer ShizZy's Avatar
    Join Date
    Feb 2005
    Location
    RI, USA
    Posts
    760
    Because some people like C better, there needs no explanation further than that

    Personally, I like to use C in a C++ programming enviroment. (By taking advantage of things like variable declarations at various points in a function, C++ libs, and on a rare occasion namespaces). For the most part though, my code is pretty straight C. Too many classes and such generally leads to fluff in my opinion, at least for emulator programming. (There is use else where though).
    ~ShizZy

    6Bit.net Emulation & Gaming | Forums
    Gekko GameCube Emulator

  10. #10
    EmuTalk Member
    Join Date
    Jul 2004
    Location
    Someplace where I don't know where I am.
    Posts
    618
    Quote Originally Posted by Doomulation
    One question though:
    Why use C?
    For me, I just don't like C++. It has too many things that I don't need, and it is easier for me to use C.

Page 1 of 2 12 LastLast

Similar Threads

  1. Problem With (I think) DirectDraw
    By thecraft in forum TechTalk
    Replies: 8
    Last Post: August 26th, 2002, 00:34
  2. Replies: 15
    Last Post: July 31st, 2002, 05:19
  3. DirectDraw 7 error
    By Winkin in forum Project64
    Replies: 3
    Last Post: July 14th, 2002, 03:41

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •