Solved

Can not build Alpha surface with DirectDraw

Posted on 2001-06-11
3
737 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
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

760 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now