Announcement

Collapse
No announcement yet.

Advanced Question. Using DDT controls with an IActiveScript Host. "NamedItems"

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Advanced Question. Using DDT controls with an IActiveScript Host. "NamedItems"

    I have posted on Jose Roca's forums asking this question.

    The Windows Common Controls used in DDT don't expose the correct interfaces to allow a script host to sink events and respond to property changes. Same goes with MFC applications, which use the same DDT technology.

    I have read that if you write a COM wrapper for the control, you can use that to be the middle man between the actual control and the host.

    My problem is, I need to convert some VB6 code to work with PowerBasic. I need to use standards, so I won't have any ActiveX controls to distribute.

    I need to get the iActiveScript interfaces working in PowerBasic, and then I need to figure out a way that the script executed can change visual properties of controls on the window.

  • #2
    >Same goes with MFC applications, which use the same DDT technology.

    DDT is proprietary so I do not have anything concrete on this, but I do not believe it operates by manufacturing and exposing COM interfaces. I also doubt DDT is same technology used in "traditional" MFC programs.

    But there is some GOOD news here....

    Anything you can do with those controls by calling a COM method* you can also do by sending messages to those controls; or, in the case of the DDT-created proprietary common controls (which really aren't but we have to pretend they are), by issues the appropriate "controlname verbname parameter(s)" statement.

    How you "package" that code is up to you.

    MCM
    *If that's what VB is actually doing. I doubt that, too. I think it's just an object-oriented source-code-level syntax which is compiled into a bunch of 'SendMessage' commands.
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      But would this allow me to use these controls in an ActiveScript host?

      What if I wrote a class that defined the properties I wanted to expose, and then add the class as a nameditem...

      Basically let the class handle it...
      Last edited by Christian McDonald; 25 May 2009, 06:59 PM.

      Comment


      • #4
        Christian,
        Your question may be basic in general, but could elude to a vast expanse of what you are trying to do.

        could you post a sample? (Heck even if it is VB compilable code) I will bet that there are enough of us "Refugee's" that could point out how the point could be done in PB

        (Don't know about you, but working on ONE smaller point goes a LONGGGgggg way for understanding the overall point, when relearning a language concept)
        Engineer's Motto: If it aint broke take it apart and fix it

        "If at 1st you don't succeed... call it version 1.0"

        "Half of Programming is coding"....."The other 90% is DEBUGGING"

        "Document my code????" .... "WHYYY??? do you think they call it CODE? "

        Comment


        • #5
          Ok here is my custom control that I developed for VB6. It isn't totally complete, but it will be a replacement for the Microsoft Script Control once it is done.

          http://pastie.org/489517

          I don't think I really need to post the type library source as it is just interface definitions and constants (it equates to a PB Include, if you want to think of it that way), but seeing as VB6 wasn't designed to interact directly with COM objects, I had to write a custom type library to allow the exposure of IUknown, IDispatch, etc... And to define the interfaces of IActiveScriptSite, IActiveScriptWindow, IActiveScriptUIControl, etc...

          Now once I have all of that, I can just do something like this:

          Place a command button on my form named Command1
          and place my scriptcontrol on my form named ScriptControl

          VB6 code:

          Code:
          ScriptControl.addObject "cmd", Command1
          msgbox ScriptControl.eval("cmd.caption")
          the eval function is evaluating cmd.caption and returning it therefore displaying it in a message box.

          Likewise...

          If I were to call

          Code:
          ScriptControl.ExecuteStatement "cmd.caption = ""This Caption is set through script"""
          The engine would take care of setting the caption of Command1, known as "cmd" to the script engine, to "This Caption is set through script"
          Last edited by Christian McDonald; 25 May 2009, 07:52 PM.

          Comment


          • #6
            DDT does not use any kind of COM implementation - it is native SDK (aka Windows API), procedural code and therefore does not use properties.

            You can write a non-visual ActiveX (COM) library that may be able to manipulate a DDT dialog and/or controls. The creation of full ActiveX controls (commonly named with OCX), that can be used with containers and have properties/methods are not supported by PB/WIN 9.
            kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

            Comment


            • #7
              There has got to be a way to do this...

              I am trying to get my code out of VB6 to future proof it. If I can get this working in PowerBasic, I won't have to worry about it for years to come...

              Comment


              • #8
                There has got to be a way to do this...

                I am trying to get my code out of VB6 to future proof it. If I can get this working in PowerBasic, I won't have to worry about it for years to come...
                There IS a way, but I will have to find my initial attempts to do the same. (Get out of VB, and yet make PB lead me away from OCX type of stuff)
                Engineer's Motto: If it aint broke take it apart and fix it

                "If at 1st you don't succeed... call it version 1.0"

                "Half of Programming is coding"....."The other 90% is DEBUGGING"

                "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                Comment


                • #9
                  Well if you are able to find a method, please let me know... I am still working on it, btw.

                  Comment

                  Working...
                  X