Results 1 to 3 of 3

Thread: Is my VC++ compiler broken?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2001
    Posts
    23

    Unhappy Is my VC++ compiler broken?

    Can someone test this DX7 app and see if it works for you?
    Thanks a lot! BTW: I included the dxguid.lib and ddraw.lib too.

    LPDIRECTDRAW lpDD;
    HRESULT ddrval;
    ddrval = DirectDrawCreate( NULL, &lpDD, NULL );
    if( ddrval != DD_OK )
    {
    // Do some error checking here
    }


    //[Setting Cooperative Level]


    ddrval = lpDD->SetCooperativeLevel( hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN );
    if( ddrval != DD_OK)
    {
    //Do some error checking here
    }


    //[Setting Video Mode]


    ddrval = lpDD->SetDisplayMode( 640, 480, 8);
    if( ddrval != DD_OK)
    {
    //Do some error checking here
    }


    //[Creating Primary Surface]


    LPDIRECTDRAWSURFACE lpDDSPrimary;
    DDURFACEDESC ddsd;
    HRESULT ddrval;

    //Clear all fields in structure
    memset( &&ddsd, 0, sizeof(ddsd) );

    //Set flags in structure
    ddsd.dwSize = sizeof( ddsd );
    ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
    ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
    ddsd.dwBackBufferCount = 1;

    //Create Surface
    ddrval = lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL );
    if( ddrval != DD_OK )
    {
    //Do error checking here
    }


    //[Creating Back Surface]


    DDSCAPS ddscaps;

    LPDIRECTDRAWSURFACE lpDDSBack; ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
    ddrval = lpDDSPrimary->GetAttachedSurface( &ddscaps, &lpDDSBack );
    if( ddrval != DD_OK )
    {
    //Do error checking here
    }


    //[Creating Offscreen Surface]


    LPDIRECTDRAWSURFACE lpDDSOffscreen;
    DDSURFACEDESC ddsd;
    HRESULT ddrval;

    ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
    ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
    ddsd.dwHeight = 480;
    ddsd.dwWidth = 640;

    ddrval = lpDD->CreateSurface( &ddsd, &lpDDSOffscreen, NULL );
    if( ddrval != DD_OK )
    {
    //Do error checking here
    }

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    What errors do you get?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Could it be that you forgot to set the dwSize members in the later structures?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

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



Click Here to Expand Forum to Full Width