Solved

Can not build Alpha surface with DirectDraw

Posted on 2001-06-11
3
742 Views
Last Modified: 2007-12-19
Colleagues,

When I'm creating an alpha surface with this code:

     LPDIRECTDRAWSURFACE lpAlphaSrfc;
     DDSURFACEDESC ddsdA;
     memset(&ddsdA, 0, sizeof(ddsdA));
     ddsdA.dwSize = sizeof(ddsdA);
     ddsdA.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_ALPHABITDEPTH;
     ddsdA.ddsCaps.dwCaps = DDSCAPS_ALPHA | DDSCAPS_OFFSCREENPLAIN;
     ddsdA.dwHeight = cursor.GetHeight();
     ddsdA.dwWidth = cursor.GetWidth();
     ddsdA.dwAlphaBitDepth = 8;

     HRESULT hr = lpDirectDrawObject->CreateSurface(&ddsdA, &lpAlphaSrfc, NULL);

I'm getting DDERR_INVALIDPARAMS. Can any one tell me, what's missing?

Thank you,
Nick
0
Comment
Question by:kender_a
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Accepted Solution

by:
GuyJohnston earned 50 total points
ID: 6274646
What version of Direct X are you using ?
Try inserting version numbers at the end of the
prototypes.
    /////////
    LPDIRECTDRAWSURFACE4 lpAlphaSrfc4; // 4 here
    DDSURFACEDESC2 ddsdA;              // 2 here
    /////////    
   memset(&ddsdA, 0, sizeof(ddsdA));
    ddsdA.dwSize = sizeof(ddsdA);
    ddsdA.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_ALPHABITDEPTH;
    ddsdA.ddsCaps.dwCaps = DDSCAPS_ALPHA | DDSCAPS_OFFSCREENPLAIN;
    ddsdA.dwHeight = cursor.GetHeight();
    ddsdA.dwWidth = cursor.GetWidth();
    ddsdA.dwAlphaBitDepth = 8;
    ////////
    HRESULT hr = lpDirectDrawObject->CreateSurface(&ddsdA, &lpAlphaSrfc4, NULL); // 4 here
    ///////
Errors could arise if correct version is not used.

0
 
LVL 11

Expert Comment

by:griessh
ID: 6814571
I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. Unless there is objection or further activity,  I will suggest to accept "GuyJohnston" comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points.
The link to the Community Support area is: http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt

Please do not accept this comment as an answer!
======
Werner
0
 
LVL 5

Expert Comment

by:Netminder
ID: 6833239
Per recommendation comment force/accepted by

Netminder
Community Support Moderator
Experts Exchange
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question