Skip to Content
author's profile photo Former Member
Former Member

Has anyone called ImageNow6.CtrlPanel from within PB?

I have a PB interface application in which I'm trying to call a vendor's API using PB 12.0 classic.

I've not had experience doing this type of call and the following was provided by the vendor as their example call using VBS:

/* Start up the client application */

Shell("C:\Program Files\ImageNow6\bin\ImageNow.exe", vbMinimizedNoFocus)

Set ViewDocObj = GetObject(, "imagenow6.CtrlPanel")

/* Wait before calling the API/Com object */

WScript.Sleep 5000

/* call the external function to display a document using the document ID (1st parameter) */

/* Return variable "showMyDoc" should return false when the call fails

showMyDoc = ViewDocObj.INViewDocDID("321YZ9W_000CWTL7R00000J", -1, 1, 1)

Vendor's comment: You should be able to use the same syntax above (GetObject) for C or C++ or .NET but for other languages, I am what the equivalent should be.


Now here is my PB equivalent which does open the vendor's application with single sign on but fails when it makes the call to display the document.

OLEObject Inow, InowPanel

INow = CREATE OLEObject

InowPanel = CREATE OLEObject

li_rc = INow.ConnectToNewObject("ImageNow.Application")

/* Run the client application minimized */

Run(ls_FullInowPath, Minimized!)

/* Connect to the com object */

li_rc = InowPanel.ConnectToNewObject("imagenow6.CtrlPanel.Application")

sleep(5)

/* call the method to display the document */

InowPanel.INViewDocDID("321YZ9W_000CWTL7R00000J", -1, 1, 1)

When that last statement is run in PB, I receive an execution error (R0035)

"Error calling external object function INViewDocDID at line 48 ..."

Based on the code examples above, what am I doing wrong in attempting to call the function to display my document within the client's application which is now open?

Sincerely,

Teresa

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Aug 15, 2016 at 07:00 PM

    Hi Teresa;

    Have you tried (instead) ....

    li_rc = InowPanel.ConnectToNewObject("imagenow6.CtrlPanel")

    Plus, Rolands ".Object." suggestion.

    Was "li_rc" successful?

    Regards ... Chris

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Teresa;

      The Object Browser's OLE section is just listing what is registered in the MS-Windows Registry as far as active OLE controls or programmable objects (PO) is concerned. Therefore, If you do not see the OCX control or PO listed - then it might be because the Microsoft / 3rd party product is not properly installed and/or registered with the O/S.

      So you can try & reinstall & register your 3rd party control or you can even do that from inside of the PB IDE as follows ...

      1) Try to create a User Object of type OLE

      2) When prompted for the control to use, select the Insert Control tab

      3) Now select the "Register New ..." command button and follow the on screen prompts. If you are successful, the ImageNow product should now appear in the list.

      Note: You can also use the "Insert File" alternative as well to register an OLE control.

      Regards ... Chris

  • Posted on Aug 17, 2016 at 09:15 AM

    Hi Teresa

    Sorry I'm a bit late to this, just back from holiday.....

    We have interfaced with Imagenow before. It was a long time ago and the client that used it is no more.

    However, the code we had was:

    ole_image = create oleobject

    result = ole_image.connecttoobject("","Imagenow.CtrlPanel")

    if result = 0 then

    ole_image.INViewDocFilter(ls_folder,cli_no,'', '','','',"tab")

    else

    messagebox('Error','Failed to connect to Imagenow!(' + string (result)+ ')')

    end if

    destroy ole_image

    Hope this helps 😊

    Regards

    David

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 15, 2016 at 06:35 PM

    Try adding Object like this:

    lnowPanel.Object.InViewDocDID

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Have you tried running the vbscript to see if it works? You can do that from a command window:

      cscript scriptname.vbs

      You could try adding a Sleep before the ConnectToNewObject to give the application time to get fully started.

  • author's profile photo Former Member
    Former Member
    Posted on Aug 15, 2016 at 07:27 PM

    Also, as this is my first attempt at using a forum for assistance I want to say Thank you to both Roland and Chris for offering their assistance. I wasn't sure what to expect.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.