locked
URGENT::GDI Display Mode issues(My GDI mode crashes randomly to a black screen when running) RRS feed

  • Question

  • hello I coded a game engine with a complete gui system.... it has a debug gdi output mode a directx 6 mode a directx 8 mode and an open gl mode... the other modes work fine for now but I have an issue where the GDI mode crashes to a black screen randomly when the app is operationg.. this happens more often on restoring from minimized or on resizing......

    please email responses to ThomasCannady@comcast.net as well as posting them here... also could you

    put "URGENT" in the email title... thanks

     

    here is the GDI code :

     

    void

     

    gdi_update(void

    )

    {

    //#ifdef FEVTRACKFPS

    // dofps();

    #

     

    //endif

     

    // Copy the backbuffer to the window

     

    // Single Threaded Version

    HDC hdcDIBSection;

    HBITMAP holdbitmap;

    hdc = GetDC(mainwin);

    hdcDIBSection = CreateCompatibleDC(hdc);

     

    if

    (gdibackbufferpage==0)

    holdbitmap = (HBITMAP)SelectObject(hdcDIBSection, (HGDIOBJ)backbufferhandle1);

     

    else

    holdbitmap = (HBITMAP)SelectObject(hdcDIBSection, (HGDIOBJ)backbufferhandle2);

     

    BitBlt(hdc, 0, 0, screenwidth, screenheight, hdcDIBSection,

    0, 0, SRCCOPY);

    ReleaseDC(mainwin, hdc);

    SelectObject(hdcDIBSection, holdbitmap);

    DeleteDC(hdcDIBSection);

     

    checkmsg();

    }

    • Moved by Rob Pan Tuesday, October 25, 2011 3:03 AM (From:Visual C++ General)
    Friday, October 21, 2011 2:11 PM

Answers