Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CompatibleDC parameter question

CompatibleDC parameter question

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    econy
    wrote on last edited by
    #1

    Hi, I have a question, situation like:

    void funcA()
    {
    CDC MemDC;
    CDC *pDC ;
    pDC = GetDC();
    memDC.CreateCompatibleDC(pDC);

    funcB(memDC);
    }

    void funcB(CDC *pDC)
    {
    HDC hdc;
    HDC hdcMem;

    hdc = pDC->m_hDC;
    hdcMem = CreateCompatibleDC(hdc);
    ...
    BitBlt(hdc,0,0,100,100,hdcMem,0,0,SRCCOPY);
    }

    I think this BitBlt() will copy hdcMem to MemDC(in FuncA), right? just want to confirm it.

    L 1 Reply Last reply
    0
    • E econy

      Hi, I have a question, situation like:

      void funcA()
      {
      CDC MemDC;
      CDC *pDC ;
      pDC = GetDC();
      memDC.CreateCompatibleDC(pDC);

      funcB(memDC);
      }

      void funcB(CDC *pDC)
      {
      HDC hdc;
      HDC hdcMem;

      hdc = pDC->m_hDC;
      hdcMem = CreateCompatibleDC(hdc);
      ...
      BitBlt(hdc,0,0,100,100,hdcMem,0,0,SRCCOPY);
      }

      I think this BitBlt() will copy hdcMem to MemDC(in FuncA), right? just want to confirm it.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      What exactly are you trying to achieve?

      E 1 Reply Last reply
      0
      • L Lost User

        What exactly are you trying to achieve?

        E Offline
        E Offline
        econy
        wrote on last edited by
        #3

        I want funcB draw picture on it's own temporary DC, then paste on funcA's memory DC, and FuncA paste the whole funcA's DC to screen. Like: B -> A c -> A ... x -> A and A -> screen. And I had another question, I have a big bitmap, represent the screen, many parts of the bitmap need to update independently and frequently. is it a good idea using one memory DC to hold all part's temporary DC, then post the whole memory DC to screen? that is, the double buffering technique.

        L 1 Reply Last reply
        0
        • E econy

          I want funcB draw picture on it's own temporary DC, then paste on funcA's memory DC, and FuncA paste the whole funcA's DC to screen. Like: B -> A c -> A ... x -> A and A -> screen. And I had another question, I have a big bitmap, represent the screen, many parts of the bitmap need to update independently and frequently. is it a good idea using one memory DC to hold all part's temporary DC, then post the whole memory DC to screen? that is, the double buffering technique.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          1. Sounds OK. What happens when you try it? 2. Yes, keeping a MemDC with all the information and then updating that, before blitting to screen is probably the best way.

          E 1 Reply Last reply
          0
          • L Lost User

            1. Sounds OK. What happens when you try it? 2. Yes, keeping a MemDC with all the information and then updating that, before blitting to screen is probably the best way.

            E Offline
            E Offline
            econy
            wrote on last edited by
            #5

            Thanks, have not try it. Just thinking if the way is reasonable.

            L 1 Reply Last reply
            0
            • E econy

              Thanks, have not try it. Just thinking if the way is reasonable.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Trying things is the best way to learn.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups