PRB: 'Invalid Picture' Error When Setting Metafile (WMF)

Last reviewed: February 29, 1996
Article ID: Q147667
The information in this article applies to:
  • Standard, Professional, and Enterprise Editions of Microsoft Visual Basic, 16-bit and 32-bit, for Windows, version 4.0

SYMPTOMS

Setting the Picture property of picture box control to a metafile (.WMF) format file can cause Visual Basic to raise the error 'Invalid Picture'.

CAUSE

This error can be caused when attempting to set the picture property to a kind of image that the control does not understand. If the file or other source of the image is corrupt then the control may not be able to interpret the image well enough to determine what kind of image it is, let alone display and manipulate it.

With WMF (metafile) image formats, an additional wrinkle is relevant. Visual Basic 4.0, and other Microsoft products such as Microsoft Word and Microsoft Excel, do not use the 'standard' metafile format. Instead, these applications use an 'Aldus Placeable Format' metafile. The formats differ in that placeable metafiles include a 22-byte 'metafileheader' data structure at the beginning of the file. The placeable metafile format is incompatible with such Windows API functions as CreateMetaFile, GetMetaFile, CopyMetaFile, and PlayMetaFile.

WORKAROUND

Sample code as well as compiled executables for utilities to convert between these metafile formats exist on the Microsoft Software Library (MSL). These samples are explained in the following Knowledge Base articles.

   ARTICLE-ID: Q129658
   TITLE     : SAMPLE: Reading and Writing Aldus Placeable Metafiles

This provides a 16-bit utility that can convert between normal Windows metafiles and the corresponding Aldus Placeable Format metafiles.

   ARTICLE-ID: Q145999
   TITLE     : SAMPLE: How to Create & Play Enhanced Metafiles in Win32

This sample provides a 32-bit utility to work with the 32-bit enhanced metafile format. The utility can also convert between normal (16-bit) metafiles and Aldus Placeable Format metafiles.

STATUS

This behavior is by design.

REFERENCES

Q129658 - SAMPLE: Reading and Writing Aldus Placeable Metafiles Q145999 - SAMPLE: How to Create & Play Enhanced Metafiles in Win32


Additional reference words: 4.00 vb4win vb4all
KBCategory: kbprb kbprg
KBSubcategory: EnvtDes


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: February 29, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.