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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CClientDc

CClientDc

Scheduled Pinned Locked Moved C / C++ / MFC
helpgraphicsannouncement
4 Posts 4 Posters 1 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.
  • V Offline
    V Offline
    VVVimal
    wrote on last edited by
    #1

    Hi I am using CClientDc in OnTimer(). Sample Code: OnTimer() { CClientDc dc; DisplayAll(dc,xCor,Ycor); Release(&dc); } But When run the program through the Deleaker I am getting GDI leak in this part. I am not sure weather the CClientDc is released. Also my applicatin size increases continously. Pls help to resolve this problem.

    _ S A 3 Replies Last reply
    0
    • V VVVimal

      Hi I am using CClientDc in OnTimer(). Sample Code: OnTimer() { CClientDc dc; DisplayAll(dc,xCor,Ycor); Release(&dc); } But When run the program through the Deleaker I am getting GDI leak in this part. I am not sure weather the CClientDc is released. Also my applicatin size increases continously. Pls help to resolve this problem.

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      You do not have to call Release. The destructor of CClientDC will do that when it goes out of scope. The leak is probably because of something that is happening inside the DisplayAll function.

      «_Superman_»
      I love work. It gives me something to do between weekends.

      Microsoft MVP (Visual C++)

      Polymorphism in C

      1 Reply Last reply
      0
      • V VVVimal

        Hi I am using CClientDc in OnTimer(). Sample Code: OnTimer() { CClientDc dc; DisplayAll(dc,xCor,Ycor); Release(&dc); } But When run the program through the Deleaker I am getting GDI leak in this part. I am not sure weather the CClientDc is released. Also my applicatin size increases continously. Pls help to resolve this problem.

        S Offline
        S Offline
        Stephen Hewitt
        wrote on last edited by
        #3

        «_Superman_» is correct: First lose the Release and see if commenting out DisplayAll stops the leaks. If it does one sledgehammer approach is comment bits of the function out bit by bit until you find the problem.

        Steve

        1 Reply Last reply
        0
        • V VVVimal

          Hi I am using CClientDc in OnTimer(). Sample Code: OnTimer() { CClientDc dc; DisplayAll(dc,xCor,Ycor); Release(&dc); } But When run the program through the Deleaker I am getting GDI leak in this part. I am not sure weather the CClientDc is released. Also my applicatin size increases continously. Pls help to resolve this problem.

          A Offline
          A Offline
          Aescleal
          wrote on last edited by
          #4

          Get rid of all drawing code in your OnTimer. Make sure OnPaint does all the drawing correctly and then replace all the code in OnTimer with: Invalidate(); That'll help sort out whether the problem is with the drawing code or whether you're committing another faux pas. In case you're wondering Invalidate tells Windows that the window you've called it on needs repainting and it should send a WM_PAINT to the app when the message queue is otherwise empty. This WM_PAINT causes OnPaint to be called. Cheers, Ash

          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