BUG: GetMetaFile() Fails on Long File Names

ID: Q232581


The information in this article applies to:
  • Microsoft Windows versions 95, 98


SYMPTOMS

The GetMetaFile() API, used to load a disk-based Windows metafile into memory, returns failure code when passed a long file name.


RESOLUTION

To work around this problem, use the metafile's short file name in the call to GetMetaFile(). Code similar to the following should work properly:


HMETAFILE MyGetMetaFile( LPTSTR szFileName )
{
	HMETAFILE	hWMF;
	TCHAR		szTemp[MAX_PATH];

	if( (hWMF=GetMetaFile(szFileName)) != NULL )
		return hWMF;
	if( GetShortPathName( szFileName, szTemp, MAX_PATH ) == 0 )
		return NULL;
	return GetMetaFile( szTemp );
} 


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

Additional query words:

Keywords : kbGDI kbMetafile kbSDKWin32 kbWinOS95bug kbWinOS98bug kbGrpGDI
Version : WINDOWS:95,98
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: June 7, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.