 |
ReleaseDC Add comment W32 Constants Translate this page |
 |
 |
|
The ReleaseDC function releases a device context (DC), freeing it for use by other applications. For memory device contexts use the DeleteDC function. |
 |
 |
| Code examples: |
 |
|
|
 |
 |
| Declaration: |
 |
 |
int ReleaseDC(
HWND hwnd, // handle of window
HDC hdc // handle of device context
);
|
 |
 |
 |
| FoxPro declaration: |
 |
 |
DECLARE INTEGER ReleaseDC IN user32;
INTEGER hwnd,;
INTEGER hdc
|
 |
 |
 |
| Parameters: |
 |
hwnd
Identifies the window whose device context is to be released
hdc
Identifies the device context to be released |
 |
 |
| Return value: |
 |
| The return value specifies whether the device context is released. If the device context is released, the return value is 1 |
 |
 |
| My comment: |
 |
Once you obtain a device context (retrieved by GetDC, or GetWindowDC functions), you may write to the window. At the end of this process the device context must be released using ReleaseDC. Otherwise you will have a memory leak.
GDI Black Book: remember, use the ReleaseDC function only for a display device context that was retrieved from the GDI device-context cache. After you"re done with the memory device context, you must free it by using the DeleteDC function.
Finally:
- use ReleaseDC for forms (the hwnd used as the first parameter)
- use DeleteDC for memory device contexts (e.g. CreateCompatibleDC function) |
 |
 |
| Word Index links for the ReleaseDC : |
 |
|
|
 |
 |
| Translate this page: |
 |
|
 |
 |
| • |
 |
| Created: | 2001-07-12 12:00:00 | | Modified: | 2002-11-28 11:13:46 | Visited in last 7 days: 226 |