Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Mman

What's wrong with this DirectDraw7 Application?

This topic is 6109 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, can someone pleas tell me why I get the errors? Thanks a lot! -------------------------------- #include HRESULT Result; LPDIRECTDRAW7 DirectDraw7Ptr; Result = DirectDrawCreate ( NULL, &DirectDraw7, IID IDirectDraw7, NULL ); if ( Result == DD_OK ) {// Create was successful } else {/*Initialization failed */} Result = DirectDraw7Ptr -> SetCooperativeLevel (Window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_ALLOWREBOOT ); if ( Result == DD_OK ) { /* The coperative level was set*/ } else {/* error*/} DDSURFACEDESC2 SurfaceDesc; bool FoundMode; ZeroMemory ( ( void * ) &SurfaceDesc, sizeof SurfaceDesc ); SurfaceDesc.dwSize = sizeof ( DDSURFACEDESC2 ); SurfaceDesc.dwFlags = DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT; SurfaceDesc.dwWidth = 1024; SurfaceDesc.dwHeight = 768; SurfaceDesc.ddpfPixelFormat.dwSize = sizeof ( DDPIXELFORMAT ); SurfaceDesc.ddpfPixelFormat.dwFlags = DDPF_RGB; SurfaceDesc.ddpfPixelFormat.dwRGBBitCount = 32; DirectDraw7Ptr ->EnumDisplayModes ( 0, &SurfaceDesc, ( void * ) &FoundMode, CallbackFunction ); HRESULT WINAPI CallbackFunction ( LPDDSURFACEDESC2 lpDDSurfaceDesc, LPVOID lpContext ) { *( ( bool * ) lpContext ) = true; return DDENUMRET_CANCEL; //stop the enumeration } Result = DirectDraw7Ptr ->SetDisplayMode (1024, 768,24,0, 0 ); if ( Result == DD_OK ) { /*Display Mode was set*/} else { /*not set*/} HRESULT Val; DDSURFACEDESC2 SurfaceDesc; LPDIRECTDRAWSURFACE7 PrimarySurface; ZeroMemory ( &SurfaceDesc, sizeof ( DDSURFACEDESC2 ) ); SurfaceDesc.swSize = sizeof ( DDSURFACEDESC2 ); SurfaceDesc.swFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; SurfaceDesc.dwBackBufferCount = 1; SurfaceDesc.ddsCaps.dwCaps = DDSCAPS_COMPLEX | DDSCAPS_FLIP DDSCAPS_VIDEOMEMORY; Val = DirectDraw7 ->CreateSurface ( &SurfaceDesc, &PrimarySurface, NULL ); if ( Val == DD_OK ) {/*surface created*/} else {/*Not created*/} bool LockSurface ( LPDIRECTDRAWSURFACE7 Surface7, RECT &Rect, DDSURFACEDESC2 &SurfaceDesc ) { HRESULT Val; ZeroMemory ( &SurfaceDesc, sizeof ( DDSURFACEDESC2 ) ); SurfaceDesc.dwSize = sizeof ( DDSURFACEDESC2 ); Val = Surface7 ->Lock ( &Rect, &SurfaceDesc, DDLOCK_NOSYSLOCK | DDLOCK_WAIT, NULL ); if ( Val ==DD_OK ) { //pointer to bits is in surfacedesc.lpsuface return true; } else { /*Locking failed */ return false; } } Surface7 ->Unlock ( &Rect );

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
i am taiwanese, so my english no good, i use DirectX 7.0

>> Result = DirectDraw7Ptr ->SetDisplayMode (1024, 768,24,0,
0 );

your video card support 24 bits display mode, are you sure?

somebody video card no support 24 bits display mode.

Share this post


Link to post
Share on other sites
Hi, no my card supports 24, 32. But here is what I get for error:

C:\Program Files\DevStudio\Vc\Ddraw7\Cpp1.cpp(6) : error C2146: syntax error : missing '';'' before identifier ''DirectDraw7Ptr''
C:\Program Files\DevStudio\Vc\Ddraw7\Cpp1.cpp(6) : error C2501: ''LPDIRECTDRAW7'' : missing storage-class or type specifiers
C:\Program Files\DevStudio\Vc\Ddraw7\Cpp1.cpp(6) : fatal error C1004: unexpected end of file found

I don''t know why, I included the ddraw.lib, dxguid.lib and I also linked all the directories.

BTW: Your English is good.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
i am taiwanese, so my english no good, i use DirectX 7.0

>> #include

#include what?

lose this:
#include <ddraw.h>

Share this post


Link to post
Share on other sites
Oh sorry, that "#include" is not there, I made a typo.

But now when i use "#include ddraw.h" i get 96 ERRORS!!!!!!



Edited by - Mman on December 27, 2001 8:32:22 PM

Edited by - Mman on December 27, 2001 8:33:09 PM

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
i am taiwanese, so my english no good, i use DirectX 7.0

if you need my source code, i can send mail to you.
so, you can see my written method, but no send to other people, ok?

Share this post


Link to post
Share on other sites
That would be great, although I prefer to keep my own method, I can use your code to see what I did wrong. Send it to www.yourik@mondenet.com

Thanks

Share this post


Link to post
Share on other sites
Dunno if you caught this or what, but in that CreateDirectDraw() function, you need an underscore between IID and IDirectDraw7.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
i am taiwanese, so my english no good, i use DirectX 7.0

ok,i send source code to you.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!