Hi..
Some API's require the
DC of a device, and not
the handle!
Whats the difference
between the two?
What does GetDC do?
Printable View
Hi..
Some API's require the
DC of a device, and not
the handle!
Whats the difference
between the two?
What does GetDC do?
don't know what it means but maybe this is useful for u:
GetDC
The GetDC function retrieves a handle to a display device context (DC) for the client area of a specified window or for the entire screen. You can use the returned handle in subsequent GDI functions to draw in the DC.
The GetDCEx function is an extension to GetDC, which gives an application more control over how and whether clipping occurs in the client area.
HDC GetDC(
HWND hWnd // handle to window
);
Parameters
hWnd
[in] Handle to the window whose DC is to be retrieved. If this value is NULL, GetDC retrieves the DC for the entire screen.
Windows 98, Windows 2000: To get the DC for a specific display monitor, use the EnumDisplayMonitors and CreateDC functions.
Return Values
If the function succeeds, the return value is a handle to the DC for the specified window's client area.
If the function fails, the return value is NULL.
Windows NT/2000: To get extended error information, call GetLastError.
Remarks
The GetDC function retrieves a common, class, or private DC depending on the class style specified for the specified window. For common DCs, GetDC assigns default attributes to the DC each time it is retrieved. For class and private DCs, GetDC leaves the previously assigned attributes unchanged.
Note that the handle to the DC can only be used by a single thread at any one time.
After painting with a common DC, the ReleaseDC function must be called to release the DC. Class and private DCs do not have to be released. ReleaseDC must be called from the same thread that called GetDC. The number of DCs is limited only by available memory.
Windows 95/98: There are only 5 common DCs available per thread, thus failure to release a DC can prevent other applications from accessing one
This may be wrong, but to me it seems to be reference to the client area of a form or window! I could be worng though.
Cool.I was right! :p
If you dont know what the client area is, take a form and remove borders, menus, caption bars and toolbars and the client area is what's left.
Oh ok.
So GetWindowRect would get the entire
windows rect, And GetClientRect would
get the CLient area of the window!!
Neat.. Thanks!
Exactly. Especially useful for taking screenshots of form without the caption bar.