Applications can use GpiCreatePS to set the device transformation so that it uses page units that might be more convenient than pels; for example, centimeters. If the output device is a screen, the application first opens a device context by calling WinOpenWindowDC. If the output device is a printer or plotter, the application opens a printer or plotter device context by calling DevOpenDC. The application then creates a presentation space by calling GpiCreatePS, specifying low-metric page units and associating the device context with the presentation space. The following figure is an example of how to set drawing units.
HWND hwnd; /* Client-window handle */
HAB hab; /* Anchor-block handle */
HPS hps; /* Presentation-space handle */
HDC hdc; /* Device-context handle */
SIZEL sizlPage; /* Presentation-page rectangle */
hdc = WinOpenWindowDC(hwnd);
sizlPage.cx = 0;
sizlPage.cy = 0;
hps = GpiCreatePS(hab, /* Anchor-block handle */
hdc, /* Device-context handle */
&sizlPage, /* Address of SIZEL structure */
PU_LOMETRIC /* Centimeters as page units */
| GPIA_ASSOC); /* Associates window DC with PS */