Microsoft KB Archive/147667

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

Article ID: 147667

Article Last Modified on 3/14/2005

-

APPLIES TO


 * Microsoft Visual Basic 4.0 Standard Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 16-bit Enterprise Edition
 * Microsoft Visual Basic 4.0 32-Bit Enterprise Edition

-



This article was previously published under Q147667



SYMPTOMS
Setting the Picture property of picture box control to a metafile (.wmf) format file can cause Visual Basic to raise the following error:

Invalid Picture.

Sample code as well as compiled executables for utilities to convert between these metafile formats exist in the articles listed in the REFERENCES section.



CAUSE
This error may occur if you attempt to set the picture property to an image type 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.



STATUS
This behavior is by design.

