Solved

Can not build Alpha surface with DirectDraw

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

792 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