Results 1 to 7 of 7

Thread: ACTIVEX problem

  1. #1

    ACTIVEX problem

    I need to access some functions of a COM class. I was able to do it as follows:

    Dim bb As Object
    Set bb = ActiveX("ClassName=ITree").Object

    Strangely, it is not working on my second attempt. It says
    "Object does not support the method"

    the function ActiveX("ClassName=ITree") seems to return something else all together.
    Any idea how to deal with the situation.

    I also tried something like this:
    Dim ab As ITree
    Set ab = New ITree

    Interestingly, I dont get any error here. But the problem is I am unable to associate the UI control to the object created.

  2. #2

    Re: ACTIVEX problem

    I assume that you have a reference to the COM class in your script, Class Lib or module?

  3. #3

    Re: ACTIVEX problem

    Late binding....
    Dim bb As TActiveX
    Set bb = ActiveX("ClassName=ITree").Object

    Early Binding....
    Add reference to the OCX file for your control then:

    Dim ab As ITree
    Set ab = New ITree

  4. #4

    Re: ACTIVEX problem

    Please set a breakpoint at line set bb = ...
    and examine the bb in a watch. What does it show?
    Are you sure the ActiveX command returns the correct object?
    What does TestPartner create if you just record a click on your control?

  5. #5

    Re: ACTIVEX problem

    Thanks for your reply.

    Q.Are you sure the ActiveX command returns the correct object?
    ActiveX command returns a wrong object.
    But the same script returns the right object in some other machine and everything is fine!!!
    I wondered if something was wrong in my registry.So I reregistered the component. Yet ActiveX returns some other object.
    If I try using simple VBA like
    dim aa as ITree
    set aa=new ITree
    I get the right object. But in this case I am unable to associate the control with the object.

    Q. What does TestPartner create if you just record a click on your control?
    Ans: ActiveX("ClassName=ITree").MouseDown 97, 5

  6. #6

    Re: ACTIVEX problem

    Thanks for posting the details! This is indeed difficult. Maybe we can find out what the difference between the two machines is...

    It could be that the objects have different properties on different machines. You could e.g. double check if the attach before the ActiveX attaches to the same window:

    set bb = ActiveX("ClassName=ITree").Object

    If "MyWindow" refers to different windows on machine A and B then the ActiveX command will also search the control in a different window and might pick the wrong one.

    You can also try to create an object map entry for your ActiveX control and use the locate button to double check if it finds the same control on both machines.

    Are there any other properties that you can use in addition to the ClassName to make the identification unique. Maybe there are two ITree objects on your window and depending on the machine TestPartner finds a different object first (if there are more objects of the same type and you do not specify anything in addition it always will take the first one).

    Just some thoughts... don't know if this will help...

  7. #7

    Re: ACTIVEX problem

    This problem was resolved once I upgraded to 5.6.
    Somehow 5.3 was unable to detect the ActiveX control in a consistent manner.
    Thanks all for your response



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 05:45 PM.

Copyright BetaSoft Inc.