Groups | Blog | Home
all groups > vb.net upgrade > may 2004 >

vb.net upgrade : Can't create a Metafile for recording using the GdiPlusFlatApi in VB6


Rainer Morgen via .NET 247
5/13/2004 4:34:48 AM
Hi,

I'm using the GdiPlusFlatApi in VB6, everything works fine except creating a Metafile for recording. Here is the code snippet:

Dim fRect As RECTF
Dim hMetaFile As Long
Dim nRet As Long
Dim hdc As Long

hdc = GetDC(0)
fRect.Left = 0
fRect.Top = 0
fRect.Right = 10000
fRect.Bottom = 10000
nRet = GdipRecordMetafileFileName(StrConv("Test.emf", vbUnicode), hdc, EmfTypeEmfPlusOnly, fRect, MetafileFrameUnitGdi, StrConv("Test", vbUnicode), hMetaFile)

I always get a returnvalue of 2, what means "invalid parameter", even when I change the both constants in every way.

Any ideas?

Thank you
Rainer Morgen

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

Jay B. Harlow [MVP - Outlook]
5/13/2004 7:47:47 AM
Rainer Morgen,
You do realize this is a VB.NET newsgroup?

Is your problem with the VB6 code itself or did you upgrade it to VB.NET and
you now have a problem?

If its the VB6 code itself, you may want to "ask down the hall" in one of
the vb newsgroups. One of the microsoft.public.vb.winapi newsgroups may
help...

If this is an upgrade problem, remember that Long is 32bit in VB6 while its
64bit in VB.NET.

Hope this helps
Jay

[quoted text, click to view]
EmfTypeEmfPlusOnly, fRect, MetafileFrameUnitGdi, StrConv("Test", vbUnicode),
hMetaFile)
[quoted text, click to view]

AddThis Social Bookmark Button