Windows SDK: Limit of Logical Coordinate System in Windows

Last reviewed: July 22, 1997
Article ID: Q39802
3.00 WINDOWS kbprg

The information in this article applies to:

  • Microsoft Windows Software Development Kit for Windows version 3.0

The limits of the logical coordinate system are from -32768 to +32767. An item can be drawn anywhere within this coordinate system; however, the window extent cannot be set to greater than 32767. (Although this might seem to limit the system to the -16384 to 16383 range, this is not the case.) If the viewport and window are set up properly, everything will be shown. For example, to set up the whole logical coordinate system to be shown within the application's area of the screen, the following code works properly:

/*  Establish viewport to be upper-left quarter of client area */

  GetClientRect(hWnd, (LPRECT) &CRect);
  SetViewportOrg(hDC, 0, 0);
  SetViewportExt(hDC, (CRect.right - CRect.left) / 2, \
                      (CRect.bottom - CRect.top) / 2);

/*  Set Window Origin and Extent such that total logical */
/*     coordinate system will cover entire client area   */

  SetWindowOrg(hDC, -32767, -32767);
  SetWindowExt(hDC, 32767, 32767);


Additional reference words: mapping modes anisotropic isotropic
KBCategory: kbprg
KBSubcategory: GdiDc
Keywords : kb16bitonly


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 22, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.