uLib  User mode C/C++ extended API library for Win32 programmers.

Module Description

Additional display context APIs.

Macros

#define OBJ_DIBSECTION   (GDI_OBJ_LAST+1)
 
#define GetCurrentFontEx(dc, plfont)   (HFONT) GetCurrentObjectEx( dc, OBJ_FONT, PLOGFONT(plfont) )
 
#define GetCurrentPenEx(dc, plpen)   (HPEN) GetCurrentObjectEx( dc, OBJ_PEN, PLOGPEN(plpen) )
 
#define GetCurrentExtPenEx(dc, pelpen)   (HPEN) GetCurrentObjectEx( dc, OBJ_EXTPEN, PEXTLOGPEN(pelpen) )
 
#define GetCurrentBrushEx(dc, plbrsh)   (HBRUSH) GetCurrentObjectEx( dc, OBJ_BRUSH, PLOGBRUSH(plbrsh) )
 
#define GetCurrentBitmapEx(dc, pbmap)   (HBITMAP) GetCurrentObjectEx( dc, OBJ_BITMAP, PBITMAP(pbmap) )
 
#define GetCurrentDibSectEx(dc, pdibs)   (HBITMAP) GetCurrentObjectEx( dc, OBJ_DIBSECTION, PDIBSECTION(pdibs) )
 
#define GetCurrentPaletteEx(dc, pwrd)   (HPALETTE) GetCurrentObjectEx( dc, OBJ_PAL, PWORD(pwrd) )
 
#define GetCurrentColorspaceEx(dc, pcs)   (HCOLORSPACE) GetCurrentObjectEx( dc, OBJ_COLORSPACE, PLOGCOLORSPACE(pcs) )
 

Functions

POINT WINAPI WhereXY (HDC dc)
 
HDC WINAPI ReleaseWndDC (HDC hdc)
 
HDC WINAPI GetDesktopDC ()
 
void WINAPI ReleaseDesktopDC (HDC hDeskDC)
 
HDC WINAPI CreateMemoryDC (UINT cx, UINT cy, OPTOUT HBITMAP *pOldBmp=NULL)
 
HBITMAP WINAPI DeleteMemoryDC (HDC hMemDC, OPTIN HBITMAP oldBmp=NULL)
 
void WINAPI GetScreenLPI (PPOINT pLpi)
 
HGDIOBJ WINAPI GetCurrentObjectEx (HDC hdc, UINT ObjType, PVOID pObjData)
 

Macro Definition Documentation

◆ OBJ_DIBSECTION

#define OBJ_DIBSECTION   (GDI_OBJ_LAST+1)

Special addition: DIB section.

Definition at line 1941 of file UtilFunc.h.

◆ GetCurrentFontEx

#define GetCurrentFontEx (   dc,
  plfont 
)    (HFONT) GetCurrentObjectEx( dc, OBJ_FONT, PLOGFONT(plfont) )

Definition at line 1943 of file UtilFunc.h.

◆ GetCurrentPenEx

#define GetCurrentPenEx (   dc,
  plpen 
)    (HPEN) GetCurrentObjectEx( dc, OBJ_PEN, PLOGPEN(plpen) )

Definition at line 1944 of file UtilFunc.h.

◆ GetCurrentExtPenEx

#define GetCurrentExtPenEx (   dc,
  pelpen 
)    (HPEN) GetCurrentObjectEx( dc, OBJ_EXTPEN, PEXTLOGPEN(pelpen) )

Definition at line 1945 of file UtilFunc.h.

◆ GetCurrentBrushEx

#define GetCurrentBrushEx (   dc,
  plbrsh 
)    (HBRUSH) GetCurrentObjectEx( dc, OBJ_BRUSH, PLOGBRUSH(plbrsh) )

Definition at line 1946 of file UtilFunc.h.

◆ GetCurrentBitmapEx

#define GetCurrentBitmapEx (   dc,
  pbmap 
)    (HBITMAP) GetCurrentObjectEx( dc, OBJ_BITMAP, PBITMAP(pbmap) )

Definition at line 1947 of file UtilFunc.h.

◆ GetCurrentDibSectEx

#define GetCurrentDibSectEx (   dc,
  pdibs 
)    (HBITMAP) GetCurrentObjectEx( dc, OBJ_DIBSECTION, PDIBSECTION(pdibs) )

Definition at line 1948 of file UtilFunc.h.

◆ GetCurrentPaletteEx

#define GetCurrentPaletteEx (   dc,
  pwrd 
)    (HPALETTE) GetCurrentObjectEx( dc, OBJ_PAL, PWORD(pwrd) )

Definition at line 1949 of file UtilFunc.h.

◆ GetCurrentColorspaceEx

#define GetCurrentColorspaceEx (   dc,
  pcs 
)    (HCOLORSPACE) GetCurrentObjectEx( dc, OBJ_COLORSPACE, PLOGCOLORSPACE(pcs) )

Definition at line 1950 of file UtilFunc.h.

Function Documentation

◆ WhereXY()

POINT WINAPI WhereXY ( HDC  dc)

WhereXY returns the current drawing position in dc.

Definition at line 78 of file GdiUtil.cpp.

◆ ReleaseWndDC()

HDC WINAPI ReleaseWndDC ( HDC  hdc)

Release a window oriented DC and return NULL if successful.
Example:

hdc = GetDC( hwnd );
hdc = ReleaseWndDC( hdc );

The associated window handle is retrieved with WindowFromDC,
so obviously this will fail with e.g a printer DC.

Definition at line 88 of file GdiUtil.cpp.

◆ GetDesktopDC()

HDC WINAPI GetDesktopDC ( )

Get an HDC for the desktop window.

Definition at line 97 of file GdiUtil.cpp.

◆ ReleaseDesktopDC()

void WINAPI ReleaseDesktopDC ( HDC  hDeskDC)

Release desktop DC.

Definition at line 102 of file GdiUtil.cpp.

◆ CreateMemoryDC()

HDC WINAPI CreateMemoryDC ( UINT  cx,
UINT  cy,
OPTOUT HBITMAP *  pOldBmp = NULL 
)

[preliminary] Create a screen compatible memory DC and drawing bitmap.

The bitmap is screen compatible, cx*cy pixels, and selected into the DC,
and if pOldBmp is not NULL, it recieves the original bitmap from the DC.
However, if cx and cy are 0, no memory bitmap is created, and pOldBmp is ignored.

◆ DeleteMemoryDC()

HBITMAP WINAPI DeleteMemoryDC ( HDC  hMemDC,
OPTIN HBITMAP  oldBmp = NULL 
)

[preliminary] Delete a memory DC, e.g. from CreateMemoryDC().

Returns the bitmap that was used for drawing in hMemDC.
Note: Don't forget to DeleteBitmap() when done with the bitmap.
And.. if CreateMemoryDC() didn't create a memory bitmap for you,
you may use DeleteDC() directly instead of DeleteMemoryDC.

◆ GetScreenLPI()

void WINAPI GetScreenLPI ( PPOINT  pLpi)

Get logical pixels per inch for the screen (i.e. desktop window).

Definition at line 141 of file GdiUtil.cpp.

◆ GetCurrentObjectEx()

HGDIOBJ WINAPI GetCurrentObjectEx ( HDC  hdc,
UINT  ObjType,
PVOID  pObjData 
)

GetCurrentObjectEx gets the handle and optional data of a GDI object in HDC.
The programmer must be sure to pass a pointer to the correct data struct.

See also
[MSDN] GetObject() and GetCurrentObject().

Definition at line 310 of file GdiUtil.cpp.