> You may be missing some needed records for setting up the records for
> playback to your chosen device.
I have been looking closely at the records in the files I am trying to
display. It seems to me that the code on the MSDN link you gave me has a bug
in it. As each record is enumerated the code elects not to play that record
if data <> IntPtr.Zero i.e. there is no data associated with that record.
The problem with this is that there seems to be records that contain no data
but are still required. In my case the MSDN code was not playing the
following records:
SetTextRenderingHint
SetAntiAliasMode
SetTextRenderingHint
SetAntiAliasMode
ResetWorldTransform
EndOfFile
So I changed the callback function on MSDN code to read:
Private Function MetafileCallback(ByVal recordType As EmfPlusRecordType,
ByVal flags As Integer, ByVal dataSize As Integer, ByVal data As IntPtr,
ByVal callbackData As PlayRecordCallback) As Boolean
Dim dataArray As Byte() = Nothing
If data <> IntPtr.Zero Then
' Copy the unmanaged record to a managed byte buffer
' that can be used by PlayRecord.
dataArray = New Byte(dataSize) {}
Marshal.Copy(data, dataArray, 0, dataSize)
End If
meta.PlayRecord(recordType, flags, dataSize, dataArray) 'note that
every record gets played even if the dataArray is empty
Return True
End Function
...and it now works fine - the only thing I find strange is that I have seen
the code in examples all over the internet and in one of our books here and
no-one else seems to have noticed the problem, or at least not mentioned it.
Anyway, if anyone else comes up with the same problem I hope this post
helps.
Michael Phillips, Jr. - 21 Apr 2008 16:37 GMT
You should document this on Microsoft's Connect site.
After, you document it you can post a link here for us to vote.
Microsoft will only correct bugs and documentation errors when they are
notified and enough developers vote for the changes.
>> You may be missing some needed records for setting up the records for
>> playback to your chosen device.
[quoted text clipped - 38 lines]
> Anyway, if anyone else comes up with the same problem I hope this post
> helps.