Newbie Question: using ActiveX in AMS 7.5

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • SGW
    Indigo Rose Customer
    • Sep 2005
    • 91

    Newbie Question: using ActiveX in AMS 7.5

    Hi,

    I have an ActiveX control that does CAD drawing. Can AMS 7.5 create a container and call, via scripting, the ActiveX functions (like draw, print, etc.)?

    I am trying to figure out if I can embed the ActiveX into an AMS 7.5 app so that it can be used as a drawing feature.

    Any help clarifying this, lead to how it could be done, would be much appreciated.

    Kind Regards,

    SGW
  • ShadowUK
    No longer a forum member
    • Oct 2007
    • 1321

    #2
    I reckon you could use System.RegisterActiveX and the Luacom Plugin which is avaliable here.

    Comment

    • Dermot
      Indigo Rose Customer
      • Apr 2004
      • 1790

      #3
      If it is a visual control, which I assume it is, then no you can't. The only way would be to create an object plugin that wraps the activex control. That's no easy task and depending on how complex the control is it may not even be possible.
      Dermot

      I am so out of here :yes

      Comment

      • Dermot
        Indigo Rose Customer
        • Apr 2004
        • 1790

        #4
        I have found one or two activex controls that I have been able to embed in an AMS listbox and then use LuaCom to control them. The control has to have a parent hwnd property that you can set, which is very rare.
        Dermot

        I am so out of here :yes

        Comment

        • SGW
          Indigo Rose Customer
          • Sep 2005
          • 91

          #5
          Hi Dermot and ShadowUK,

          Thanks for your suggestions. I've downloaded the plugin and it's PDF to see if I can figure it out.

          It does appear that there is a hwnd available, so this may not be a problem.

          The big challenge for me as an AMS beginner is whether I can figure out the scripting to successfully call functions in the ActiveX. The language that the ActiveX function calls is written in is C++, so getting these into LUA syntax will be a steep learning curve.

          Kind Regards,

          SGW

          Comment

          • ShadowUK
            No longer a forum member
            • Oct 2007
            • 1321

            #6
            Originally posted by SGW View Post
            Hi Dermot and ShadowUK,

            Thanks for your suggestions. I've downloaded the plugin and it's PDF to see if I can figure it out.

            It does appear that there is a hwnd available, so this may not be a problem.

            The big challenge for me as an AMS beginner is whether I can figure out the scripting to successfully call functions in the ActiveX. The language that the ActiveX function calls is written in is C++, so getting these into LUA syntax will be a steep learning curve.

            Kind Regards,

            SGW
            If you know C++ you should take a look at the IndigoRose Product SDK. Maybe you could make it an object plugin.

            Comment

            • SGW
              Indigo Rose Customer
              • Sep 2005
              • 91

              #7
              Hi ShadowUK,

              I wish I knew C++. Unfortunately, all I was saying is that the ActiveX developer has written their help guide examples for function calls in C++.

              Kind Regards,

              SGW

              Comment

              • ShadowUK
                No longer a forum member
                • Oct 2007
                • 1321

                #8
                Originally posted by SGW View Post
                Hi ShadowUK,

                I wish I knew C++. Unfortunately, all I was saying is that the ActiveX developer has written their help guide examples for function calls in C++.

                Kind Regards,

                SGW
                I wish I knew it too. :(

                Comment

                • Dermot
                  Indigo Rose Customer
                  • Apr 2004
                  • 1790

                  #9
                  You don't need to know C++ to use an activex control with LuaCOM. Can you point me to a trial version of this control? I can generate a html file listing all the functions and properties and how to use them with LuaCOM.
                  Dermot

                  I am so out of here :yes

                  Comment

                  • SGW
                    Indigo Rose Customer
                    • Sep 2005
                    • 91

                    #10
                    Hi Dermot,

                    Here's a link to a fully working, though unlicensed version, with complete help guide materials:



                    The first challenge I would face is loading the ActiveX into an AMS project so that its basic drawing canvas would display in runtime.

                    Second challenge would be to figure out the function call to register the code that the developer sent to me, so that the "Unregistered Version" display no longer shows in the canvas window when running. The C++ guidelines to register this registration code and remove the unregistered display are in the help guide chm when searched for the word: "register."

                    Any help getting this started would provide a lot of learning, LUA scripting examples for function call and be much appreciated.

                    Kind Regards,

                    SGW

                    Comment

                    • Dermot
                      Indigo Rose Customer
                      • Apr 2004
                      • 1790

                      #11
                      Attached is the Lib info which lists all the enumerations and functions. I don't think there is anyway to embed it in AMS though. You can access the functions using LuaCom, but it is not much use when you can't see anything.

                      This will display the about box.
                      Code:
                      vecad = luacom.CreateObject("VeCAD.Ctrl.1")
                      
                      if vecad then
                      	vecad:AboutBox()
                      else
                      	Dialog.Message("Failed", "Could not create object")
                      end
                      Last edited by Dermot; 11-14-2009, 09:33 PM.
                      Dermot

                      I am so out of here :yes

                      Comment

                      • Dermot
                        Indigo Rose Customer
                        • Apr 2004
                        • 1790

                        #12
                        You can register it like this.
                        Code:
                        vecad = luacom.CreateObject("VeCAD.Ctrl.1")
                        
                        if vecad then
                        	result = vecad:Registration(Your reg code)
                                if result then
                                    --Registered
                                else
                                    -- not registered
                                end
                        else
                        	Dialog.Message("Failed", "Could not create object")
                        end
                        Dermot

                        I am so out of here :yes

                        Comment

                        • ShadowUK
                          No longer a forum member
                          • Oct 2007
                          • 1321

                          #13
                          How did you do that Dermot? Getting the functions and stuff.

                          Also, this is not a newbie question. Quite an advanced one at that.

                          Comment

                          • Dermot
                            Indigo Rose Customer
                            • Apr 2004
                            • 1790

                            #14
                            Originally posted by ShadowUK View Post
                            How did you do that Dermot? Getting the functions and stuff.

                            Also, this is not a newbie question. Quite an advanced one at that.
                            I used LuaCOM version 1.3. It has a DumpTypeLib function that creates the html file.
                            Dermot

                            I am so out of here :yes

                            Comment

                            • Dermot
                              Indigo Rose Customer
                              • Apr 2004
                              • 1790

                              #15
                              Here is an example project using LuaCOM 1.3. It generates the typelib info for the VeCAD control but you can change it to any control you want.
                              Last edited by Dermot; 11-14-2009, 09:33 PM.
                              Dermot

                              I am so out of here :yes

                              Comment

                              Working...
                              X