Home Image-Pro Plus Automation with Macros

Debugging VB code with Image-Pro Plus

(Originally posted by KevinR on 11/27/2006)

A common problem when debugging VB code with IPP is that the path does not work. Image-Pro uses the ipc32.dll and ipcom32.dll modules for all interprocess communication, and for a VB .EXE or .DLL to call AutoPro commands requires that the VB application be using the _same_ ipc32.dll that Image-Pro is.

The primary way to ensure that is to put the dll or .exe into the Image-Pro directory. This is fine for delivered modules, but a pain for debugging, as this requires that either your project (.VBP) file or the entire development directory also be in the Image-Pro directory.

The alternate is to put the Image-Pro directory in the $PATH for the machine, but various developers have run into trouble with that, too.

Here's a suggested solution that allows debugging of development code from any location on your development machine.

For a VB .exe file that works with Image-Pro:


Private Sub Form_Load()

    ' Debugging code, comment/remove before releasing...
    ChDir "c:\ipwin62"
    MsgBox "Changing directory to C:\Ipwin62", vbOKOnly, "Debugging"

End Sub


For Image-Pro plug-ins developed with the SDK:


Private Sub IPluginTask_Invoke()

    ' Debugging code, comment/remove before releasing...
    ChDir "c:\ipwin62"
    MsgBox "Changing directory to C:\Ipwin62", vbOKOnly, "Debugging"

    ' Restore window position and show the form
    IpAppWndRestorePos Task1Dlg.hWnd, Task1Dlg.Caption, "WinPos"
    ' Make the form a child of Image Pro window
    IpAppAttach Task1Dlg.hWnd
End Sub


The 'ChDir' location should be set to your IPP directory. If you are developing plug-ins using the SDK the project debugging preferences should be set to run IPP first when debugging.

Note that these lines with a hard-coded path SHOULD BE REMOVED BEFORE RELEASE of your modules - it's there for debugging, and may interfere with a delivered module if the user has installed to something other than the default directory. That's part of the reason for the MsgBox - if you don't comment out those lines you will get a nag dialog on your released modules.

Changing the directory to your Image-Pro folder ensures that the VB project will find the correct ipc32.dll module. If the ChDir (as here) is set before calling any IPP functions you should be good for debugging any VB code with Image-Pro.

I hope this is helpful!

Sign In or Register to comment.