Microsoft KB Archive/287168

From BetaArchive Wiki

GDI DPtoLP() Function Cannot Return Value Beyond (-32768, 32767)

Q287168



The information in this article applies to:


  • Microsoft Windows 95
  • Microsoft Windows 98
  • Microsoft Windows 98 Second Edition
  • Microsoft Windows Millennium Edition





SYMPTOMS

The DPtoLP function converts device coordinates into logical coordinates. The conversion depends on the mapping mode of the device context, the settings of the origins and extents for the window and viewport, and the world transformation.

This function is declared in wingdi.h as:

BOOL DPtoLP(
  HDC hdc,           // handle to device context
  LPPOINT lpPoints,  // array of points
  int nCount         // count of points in array
); 

The x and y coordinates that are contained in each POINT structure are transformed. However, the transformation may result in a value beyond the range of (-32768, 32767). If this occurs, the DPtoLP function returns -32768 or 32767 only, which is not expected by the caller.



CAUSE

In Windows 95, Windows 98, and Windows Millennium Edition (Me), the thunk layer converts the POINT array of 32-bit coordinate values to an array of 16-bit coordinate values and back. Therefore, in these versions of Windows, DPtoLP cannot return a value larger than can be represented by a signed 16-bit integer (ranging from -32768 through 32767, inclusive).



STATUS

Microsoft has confirmed this to be a design limitation in the Microsoft products that are listed at the beginning of this article.

Additional query words:

Keywords : win95 win98 win98se kbWinME
Issue type : kbprb
Technology : kbWinMEsearch kbWin95search kbWin98search kbWin98SEsearch kbWin95 kbWin98 kbWinME kbWin98SE


Last Reviewed: February 21, 2001
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.