Home Image-Pro Automation (Macros, Apps, Reports)

McApplication.IMcDocuments Collection looses FileName values

Hi,
with my former post about Image Names, I switched from McImage.Names and DisplayNames to IMcDocument.FileName as this is the one value that never changes.

But now I have noticed, that the FileName values "disappear" on certain occasions (not identified), and only the FileName values. DisplayName and Name values do still return the correct Strings. So my question is, does anybody know why and when the FileName value is returned as empty String (even it returned the correct file path with the same image in the same session before) or if this is a bug. 

Best regards,
Helga

Just in case this helps, this is my code snippet (VB.Net app with Image-Pro 11.0.4):

Function IsImageOpen(ByRef application As Interop.IMcApplication, ByVal imageFilePath As String) As Boolean
Dim isOpen As Boolean
For Each doc As IMcDocument In application.documents.values
    If doc.FileName = imageFilePath Then
        isOpen = True
        Exit For
    End If
Next
Return isOpen
End Function

Best Answer

  • Answer ✓
    Hi Helga,

    I wouldn't recommend using FileName property as, you have already noticed, it can disappear when the image is no longer associated with a file. It can happen when image is duplicated or converted. McImage.Name is more reliable and always unique in the current Image-Pro session.

    Yuri

Sign In or Register to comment.