CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Location
    Malaysia
    Posts
    224

    Create memory DC


    How to create a memory DC which cannot be see but can paint as usual
    DC? I check CreateCompatibleDC, it need a HDC which "shall" be show..(i try hide, but cannot work).
    i try CreateDC("DISPLAY",NULL,NULL,NULL) but it paint into desktop,
    i try CreateDC with all parameter NULL, i get nothing..
    Ang idea?
    Thanks
    Thanks

    Hello World!!!

  2. #2
    Join Date
    May 1999
    Location
    Farnborough, Hants, England
    Posts
    710

    Re: Create memory DC

    CreateCompatibleDC() IS a memory DC - although you pass it an existing DC, the existing DC could be an existing memory DC, or it can be a (visible) window DC - it does not matter. If you draw to the newly-created DC it will NOT be visible unless you BltBit() to the visible DC. All you are doing with the parameter to CreateCompatibleDC() is telling it HOW the DC should be created (what attributes to give it - colour planes, bits per pixel, etc.) - you are not actually making it visible like the original. It is safe to draw on it, and then BitBlt() it when ready to display it - this is how you can prepare the next frame in an animation before showing it.

    You're right about CreateDC() - it actually creates a DC which represents, or more to the point IS, the device you created it for - hence with "DISPLAY", it is actually a channel to the screen itself, not a memory copy.

    --
    Jason Teagle
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured