Click here to Skip to main content
15,925,399 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: ADO Recordset Pin
Kurt _B8-Oct-04 2:31
Kurt _B8-Oct-04 2:31 
GeneralGetting rid of C4005 Pin
Tom Archer7-Oct-04 18:10
Tom Archer7-Oct-04 18:10 
GeneralRe: Getting rid of C4005 Pin
Ryan Binns7-Oct-04 18:13
Ryan Binns7-Oct-04 18:13 
GeneralRe: Getting rid of C4005 Pin
Tom Archer7-Oct-04 18:56
Tom Archer7-Oct-04 18:56 
GeneralRe: Getting rid of C4005 Pin
Ryan Binns7-Oct-04 20:58
Ryan Binns7-Oct-04 20:58 
GeneralRe: Getting rid of C4005 Pin
Tom Archer8-Oct-04 1:20
Tom Archer8-Oct-04 1:20 
GeneralRe: Getting rid of C4005 Pin
Ryan Binns8-Oct-04 4:25
Ryan Binns8-Oct-04 4:25 
QuestionDirectdrawsurface gets lost??? Pin
Dani1000017-Oct-04 17:18
Dani1000017-Oct-04 17:18 
I am trying to gradually blend a bitmap onto the primary surface, it works one time but when I try to do it again, the lpDDSBack.lpSurface is set to 0x000000,which it was not in the first execution!, and I am getting an exception error,

how could this be?

First I load the bitmap into the directdrawsurface lpDDSBitmap using the DDLoadBitmap function!

win* p;


typedef struct win
{
LPDIRECTDRAW lpDD;
LPDIRECTDRAWSURFACE lpDDSPrimary;
LPDIRECTDRAWSURFACE lpDDSBack;
LPDIRECTDRAWSURFACE lpDDSBitmap;
LPDIRECTDRAWCLIPPER lpClipper;
}


p->lpDDSBitmap=DDLoadBitmap(p,p->lpDD,L"crystalcocktail.bmp");



IDirectDrawSurface * DDLoadBitmap(win* p,IDirectDraw *pdd, LPCTSTR szBitmap)<br />
{<br />
    HBITMAP hbm;<br />
    BITMAP bm;<br />
    IDirectDrawSurface *pdds;<br />
<br />
   hbm=SHLoadDIBitmap(szBitmap);<br />
   if (hbm == NULL){<br />
           return NULL;<br />
  }<br />
<br />
    GetObject(hbm, sizeof(bm), &bm); // get size of bitmap<br />
<br />
   <br />
    // create a DirectDrawSurface for this bitmap<br />
      <br />
    pdds = CreateOffScreenSurface(pdd, bm.bmWidth, bm.bmHeight);<br />
        if (pdds) {<br />
        DDCopyBitmap(pdds, hbm, bm.bmWidth, bm.bmHeight);<br />
    }<br />
<br />
    DeleteObject(hbm);<br />
<br />
    return pdds;<br />
}


And then I Blit the bitmap surface to the Backbuffer using the Flip_Bitmap_To_Back(p):

bool_t Flip_Bitmap_To_Back(win* p)<br />
{<br />
    HRESULT ddrval;<br />
    RECT rcRectSrc;<br />
    RECT rcRectDest;<br />
    POINT pt;<br />
<br />
        // first we need to figure out where on the primary surface our window lives<br />
        pt.x = 0; pt.y = 0;<br />
        ClientToScreen(p->Wnd, &pt);<br />
        GetClientRect(p->Wnd, &rcRectDest);<br />
        OffsetRect(&rcRectDest, pt.x, pt.y);<br />
        SetRect(&rcRectSrc, 0, 0, 472, 286);   //var 472 286<br />
        ddrval =IDirectDrawSurface_Blt(p->lpDDSBack, &rcRectDest, p->lpDDSBitmap, &rcRectSrc, DDBLT_WAIT, NULL);<br />
        if(ddrval==DDERR_SURFACELOST){<br />
		   restoreAll(p);<br />
		}<br />
}


And then finally I uses the blendfunction

BltAlpha(p->lpDDSPrimary,p->lpDDSBack,0,0,&r,128,RGBMODE_565); //var RGBMODE_565
}

If I do this one more time the exception error occurs, and I don´t know why, could it be that the surface gets lost in some of the actions or?????

Please help me someone, thanks Dani
GeneralFullscreen C++ Apps Pin
Makutu7-Oct-04 16:12
Makutu7-Oct-04 16:12 
GeneralRe: Fullscreen C++ Apps Pin
Alexander Shevchenko7-Oct-04 18:13
Alexander Shevchenko7-Oct-04 18:13 
GeneralRe: Fullscreen C++ Apps Pin
Makutu8-Oct-04 11:45
Makutu8-Oct-04 11:45 
QuestionWhich graphic library is the best out there? Pin
bektek7-Oct-04 16:00
bektek7-Oct-04 16:00 
AnswerRe: Which graphic library is the best out there? Pin
ThatsAlok7-Oct-04 18:53
ThatsAlok7-Oct-04 18:53 
GeneralDIfferance Pin
Anonymous7-Oct-04 15:39
Anonymous7-Oct-04 15:39 
GeneralRe: DIfferance Pin
toxcct7-Oct-04 21:13
toxcct7-Oct-04 21:13 
GeneralRe: DIfferance Pin
Yulianto.7-Oct-04 23:23
Yulianto.7-Oct-04 23:23 
GeneralRe: DIfferance Pin
toxcct9-Oct-04 0:15
toxcct9-Oct-04 0:15 
GeneralRe: DIfferance Pin
Yulianto.11-Oct-04 19:00
Yulianto.11-Oct-04 19:00 
GeneralRe: DIfferance Pin
markkuk7-Oct-04 23:57
markkuk7-Oct-04 23:57 
GeneralRe: DIfferance Pin
Anonymous8-Oct-04 7:38
Anonymous8-Oct-04 7:38 
GeneralRe: DIfferance Pin
markkuk8-Oct-04 11:45
markkuk8-Oct-04 11:45 
Questionhow to set a bitmap as the background of ricdedit control? Pin
boyboy7-Oct-04 13:49
boyboy7-Oct-04 13:49 
AnswerRe: how to set a bitmap as the background of ricdedit control? Pin
Anonymous9-Oct-04 15:10
Anonymous9-Oct-04 15:10 
GeneralMortgage Amortization Pin
sweetlady7-Oct-04 13:44
sweetlady7-Oct-04 13:44 
GeneralRe: Mortgage Amortization Pin
Colin Angus Mackay7-Oct-04 14:13
Colin Angus Mackay7-Oct-04 14:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.