Greetings.
I am a developer using LEADTOOLS version 11.5 in Visual Basic 6.0, and I am working on an application that uses the LEAD Main Control component (LTOCX11N.ocx version 11.5.0.8) to help do some image conversion with diagrams that are used.
Our diagram tool successfully generates a metafile (*.wmf) which contains the diagram. There then exists code that uses the
LoadPicture function to load the .wmf file into a StdPicture object. (All .wmf files are able to be successfully read into the StdPicture object.) After the diagram has been loaded into the StdPicture object, the LEAD object is then used. The SetPicture function is used with the StdPicture object. Most of the time this works without issue; however, there has been an issue where this sometimes yields a “Run-time error ‘20001’: LEAD Error: Not enough memory available” when using the SetPicture function.
After investigating the issue, I noticed a pattern: every time that the SetPicture function yielded the “Out of Memory” error, the .Height property of the StdPicture object contained a negative value. No other .wmf file causes this error except those that contain that negative .Height value.
I was hoping that there might be some information on what would cause this error with the SetPicture function, and if there was way it could be circumvented.
Attached to this message is a zip file containing a sample VB6 project (along with the compiled .exe file, and two .wmf files: one that works correctly, and one that does not) which should illustrate the error that we are getting.
Here is a snapshot of the relevant code used to reproduce the error:
======================================================
Private Sub Command1_Click()
Dim picvalue As StdPicture
Set picvalue = LoadPicture("working_file.wmf")
MsgBox "Working height from file = " & CStr(picvalue.Height)
LEAD1.SetPicture picvalue
Dim picvalue2 As StdPicture
Set picvalue2 = LoadPicture("nonworking_file.wmf")
MsgBox "Non working height from file = " & CStr(picvalue2.Height)
LEAD1.SetPicture picvalue2
End Sub
=======================================================
Any information you may have that would help us sort out this issue would be greatly appreciated. I’ll look forward to hearing back from you.
Thanks for your time.