Click here to Skip to main content
15,897,371 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: want suggestion in MFC. Pin
Anonymous18-Nov-02 16:54
Anonymous18-Nov-02 16:54 
GeneralHelp: Performance Counter (PerfLib) 8-Byte Alignment Warning (Event ID 1016) Pin
Gaul18-Nov-02 13:32
Gaul18-Nov-02 13:32 
QuestionHow do you prevent font size change while scaling DC? Pin
Miguel Lopes18-Nov-02 13:13
Miguel Lopes18-Nov-02 13:13 
GeneralGUI Leaks Pin
Matthew R. Miller18-Nov-02 12:25
Matthew R. Miller18-Nov-02 12:25 
GeneralRe: GUI Leaks Pin
Christian Graus18-Nov-02 12:38
protectorChristian Graus18-Nov-02 12:38 
GeneralSaving a tree control Pin
Russell Thorburn18-Nov-02 11:23
sussRussell Thorburn18-Nov-02 11:23 
GeneralRe: Saving a tree control Pin
Joaquín M López Muñoz18-Nov-02 11:30
Joaquín M López Muñoz18-Nov-02 11:30 
GeneralDirectX problem Pin
Selevercin18-Nov-02 11:19
Selevercin18-Nov-02 11:19 
Hi,

I posted this message before, but maybe this time I can give a little more information.

I wrote a DirectX program using Marcio Ritter's tutorial. Sadly, it crashes everytime I run it. I have, however, narrowed it down to a line of code that is causing the problem. Here is the function, ProcessIdle()

void ProcessIdle()
{
	HRESULT hRet;
	BOOL bOK;

	// this line right here is causing problems...
	bOK = g_Brick.Draw(g_pDDSBack, 10, 10, 2, 2, 10,10);

    while( 1 )
    {
        hRet = g_pDDSFront->Flip(NULL, 0 );
        if( hRet == DD_OK )
        {
            break;
        }
        if( hRet == DDERR_SURFACELOST )
        {
            g_pDDSFront->Restore();
        }
        if( hRet != DDERR_WASSTILLDRAWING )
        {
            break;
        }
    }
}</code>


The while loop also causes problems if I remove the first problem line. I think that may be because I can only test that line when I remove the first problem line, and it needs that line to run.

Here is the function that the problem line calls:

BOOL CSurface::Draw(LPDIRECTDRAWSURFACE7 lpDest, int iDestX, int iDestY, int iSrcX, int iSrcY, int nWidth, int nHeight)
{
	RECT    rcRect;
    HRESULT    hRet;

    if(nWidth == 0)
        nWidth = m_Width;

    if(nHeight == 0)
        nHeight = m_Height;

    rcRect.left   = iSrcX;
    rcRect.top    = iSrcY;
    rcRect.right  = nWidth  + iSrcX;
    rcRect.bottom = nHeight + iSrcY;

    while(1)
    {
        if((int)m_ColorKey < 0)
        {
            hRet = lpDest->BltFast(iDestX, iDestY, m_pSurface, 
                                   &rcRect,  DDBLTFAST_NOCOLORKEY);
        }
        else
        {
            hRet = lpDest->BltFast(iDestX, iDestY, m_pSurface, 
                                   &rcRect,  DDBLTFAST_SRCCOLORKEY);
        }

        if(hRet == DD_OK)
            break;

        if(hRet == DDERR_SURFACELOST)
        {
            Restore();
        }
        else
        {
            if(hRet != DDERR_WASSTILLDRAWING)
                return FALSE;
        }
    }

    return TRUE;
}</code>


Thanks for your help! If you need to see the source code, PLEASE e-mail me for it! (nreveles@austin.rr.com)

If you have a problem with my spelling, just remember that's not my fault. I [as well as everyone
else who learned to spell after 1976] blame it on
Robert A. Kolpek for U.S. Patent 4,136,395.

GeneralRe: DirectX problem Pin
Paul M Watt18-Nov-02 13:29
mentorPaul M Watt18-Nov-02 13:29 
GeneralSubtle bug with static members... Pin
Jamie Hale18-Nov-02 10:54
Jamie Hale18-Nov-02 10:54 
GeneralRe: Subtle bug with static members... Pin
Christian Graus18-Nov-02 11:05
protectorChristian Graus18-Nov-02 11:05 
GeneralRe: Subtle bug with static members... Pin
Jamie Hale18-Nov-02 11:10
Jamie Hale18-Nov-02 11:10 
GeneralRe: Subtle bug with static members... Pin
Christian Graus19-Nov-02 10:08
protectorChristian Graus19-Nov-02 10:08 
GeneralRe: Subtle bug with static members... Pin
Jamie Hale18-Nov-02 11:05
Jamie Hale18-Nov-02 11:05 
GeneralRe: Subtle bug with static members... [corrected] Pin
Joaquín M López Muñoz18-Nov-02 11:06
Joaquín M López Muñoz18-Nov-02 11:06 
GeneralRe: Subtle bug with static members... [corrected] Pin
Jamie Hale18-Nov-02 11:11
Jamie Hale18-Nov-02 11:11 
GeneralRe: Subtle bug with static members... [corrected] Pin
Joaquín M López Muñoz18-Nov-02 11:19
Joaquín M López Muñoz18-Nov-02 11:19 
GeneralMessagebox and Manifest Pin
S van Leent18-Nov-02 10:48
S van Leent18-Nov-02 10:48 
GeneralRe: Messagebox and Manifest Pin
EVILkos13-Dec-09 2:31
EVILkos13-Dec-09 2:31 
GeneralCustom shaped dialogs Pin
Dean Michaud18-Nov-02 10:18
Dean Michaud18-Nov-02 10:18 
GeneralRe: Custom shaped dialogs Pin
Navin18-Nov-02 10:34
Navin18-Nov-02 10:34 
GeneralRe: Custom shaped dialogs Pin
Dean Michaud18-Nov-02 10:45
Dean Michaud18-Nov-02 10:45 
GeneralRe: Custom shaped dialogs Pin
Michael Dunn18-Nov-02 11:18
sitebuilderMichael Dunn18-Nov-02 11:18 
GeneralRe: Custom shaped dialogs Pin
Atlantys19-Nov-02 3:07
Atlantys19-Nov-02 3:07 
GeneralAdding MFC to a non-MFC project Pin
Dave_18-Nov-02 10:03
Dave_18-Nov-02 10:03 

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.