DOCUMENT:Q94602 26-JUN-1999 [win16sdk] TITLE :PRB: How to Work Around WMFDCODE 64K Limitation PRODUCT :Microsoft Windows Software Development Kit PROD/VER:WINDOWS:3.1 OPER/SYS: KEYWORDS:kb16bitonly kbSDKWin16 ====================================================================== 3.10 WINDOWS kbprg kbprb ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Windows Software Development Kit (SDK) 3.1 ------------------------------------------------------------------------------- SYMPTOMS ======== The sample application, WMFDCODE, supplied in the Windows 3.1 Software Development Kit (SDK) can only read metafiles that are less than 64K in size. To work around this 64K limitation, add one line and modify two lines. In the file, WMFMETA.C, in the function RenderPlaceableMeta, add this line: long lBytesRead; // Number of bytes read. Change the _lread function to _hread to allow the function to use HUGE pointers to read the file. Also, change the return value to lBytesRead so that it can accept a long value: /* read metafile bits */ lBytesRead = _hread(fh, lpMem, (LONG)(mfHeader.mtSize * 2)); Next, change the if statement that compares the value returned from: if ( lBytesRead with -1 ) { to the following line, which uses long values: /* if there was an error */ if ( lBytesRead == -1L ) { STATUS ====== This behavior is by design. Additional query words: 3.10 ====================================================================== Keywords : kb16bitonly kbSDKWin16 Technology : kbAudDeveloper kbWin3xSearch kbSDKSearch kbWinSDKSearch kbWinSDK310 Version : WINDOWS:3.1 Issue type : kbprb ============================================================================= 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. Copyright Microsoft Corporation 1999.