Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Diff Betwn CClientDC & CWindowDC??

Posted on 1999-07-19
4
Medium Priority
?
1,063 Views
Last Modified: 2013-11-20
What is the difference between MFC classes "CClientDC" and "CWindowDC"??? Both the classes are derived from CWnd and have a protected "hWnd" member variable(afxwin.h). What scenario suits the usage of which class????

Thanks
0
Comment
Question by:kbsha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 2

Accepted Solution

by:
rayb earned 300 total points
ID: 1310428
CClientDC by default only includes the client area of your window while CWindowDC contains the non-client area as well.


0
 
LVL 3

Expert Comment

by:Shay050799
ID: 1310429
clientdc is the area returns from
GetClientRect()
and Windowsdc
is what returns from GetWindowRect() including the statusbar and the toolbar and menu area
0
 
LVL 23

Expert Comment

by:naveenkohli
ID: 1310430
CClientDC objects encapsulate working with a device context that represents only the client area of a window. The CClientDC constructor calls the GetDC function, and the destructor calls the ReleaseDC function. CWindowDC objects encapsulate a device context that represents the whole window, including its frame. A CWindowDC object accesses the entire screen area of a CWnd (both client and nonclient areas).

CClientDC creates a a client area DC that can be used outside OnPaint. Means its scope is not limited to OnPaint function. you can call it in any function when you want to to do drawing operation for that window. e.g. In button down messages..

You can make use of CwindowDC for drawing operation on client as well as non-client ares of the window like title bar, borders. This is most commonly used when u want to draw on non-client areas e.g. cutomized title bars :) But the best approach for this situation is handling WM_NCPAINT maessage.

0
 

Author Comment

by:kbsha
ID: 1310431
Comments from naveenkohli were really elobarative. Thanks for all of u....
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question