General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion Migration from XMetaL to XMAX

  • elias

    Migration from XMetaL to XMAX

    Participants 4
    Replies 5
    Last Activity 11 years, 9 months ago

    Hello!
    I've got a plugin (dll) for XMetaL written in C++ language (IDE – MS Visual Studio 2003). The plugin uses
    classes like DOMElement (having COleDispatchDriver as a parent class).
    dll methods (marked as STDMETHOD) are used via mcr-file in XMetaL 6.0.
    How can I use this plugin in XMAX component? Will transfer to XMAX be difficult?
    Are there any examples/tutorials for it (how to link XMControl.dll with dll functions)?
    My task is to connect XMAX and my plugin. The containter application will be determined later.
    So can I use VB.Net sample (XMActiveX_VBSample) as a container application?

    Reply

    Derek Read

    Reply to: Migration from XMetaL to XMAX

    XMAX creates a script engine in the same manner as XMetaL Author. However, there is this difference between the two products:
    • XMetaL Author injects 5 top-level objects (Application, Document, Documents, Selection, and ResourceManager).
    • XMAX injects 2 top-level objects (ActiveDocument and Selection).

    Because XMAX does not include the GUI to support Application, Documents, or ResourceManager it does not make sense to include them (you would build the equivalents of these into your GUI if you require them for your XMAX solution, and in that case you can create any interfaces that you need).

    You say you are using COleDispatcher so you can likely avoid recompiling your DLL (even though XMAX has a different type library). In other words, your use of IDispatch to call DOMElement methods and properties should work fine with XMAX.

    Note that XMAX fires the same document-level event macros as XMetaL Author (On_Macro_File_Load, On_Document_Open_Complete, On_Update_UI, etc). XMAX uniquely reflects some of these event macros to the container application via an event sink called _IXMetaLControlEvents.

    Reply

    elias

    Reply to: Migration from XMetaL to XMAX

    OK, thank you!
    But how XMAX component will know about MCR which contains event handlers?

    Reply

    Derek Read

    Reply to: Migration from XMetaL to XMAX

    If you need XMAX to load an MCR file you have two options:

    1. Build a XAC file using XMetaL Developer that contains your customizations files, including the MCR file. Then as part of your XMAX code use the parameter that tells it to load a specific XAC file when loading an XML document.
    2. Place your MCR file in the same location as the DTD or XSD that XMAX is loading (usually based on the SYSTEM id in the DOCTYPE declaration in the XML or the schemaLocation attribute) and give the MCR file the same name as the DTD or XSD. It will then be loaded. If you want your CSS and CTM file to be loaded this way they must also have the same filename:
    myschema.dtd
    myschema.mcr
    myschema.css
    myschema.ctm

    Reply

    elias

    Reply to: Migration from XMetaL to XMAX

    XMAX is embedded into XMActiveX_VBSample. XMActiveX_VBSample runs and loads xac-file into XMAX object. The corresponding mcr-script tells XMAX to create another ActiveX object (as a plugin).
    Should this ActiveX plugin attach dispatch or create dispatch (in terms of MFC library) in order to work with the embedded XMAX?
    Unfortunately I can't detect the running instance of XMAX. By the way, are there any standard means to detect the items in ROT (Running Object Table)?
    I have used CLSIDFromProgID (getting CLSID from “XMetaL.Control” string) and GetActiveObject in order to check for existing XMAX, but the check fails.
    Can you show me some piece of code which shows the correct way of linking running XMAX object with another ActiveX object?
    May be, there are some peculiarities with XMAX. For example, I've read that the usage of GetActiveObject for Excel required that the focus had to be moved away from Excel window (http://support.microsoft.com/kb/238610/en-us).       

    Reply

    elias

    Reply to: Migration from XMetaL to XMAX

    Now I am able to add the XMAX object to the ROT with the help of RegisterActiveObject.
    GetActiveObject works fine, but I've got DISP_E_MEMBERNOTFOUND error
    when I try to show About box. This method works fine within VB .NET sample container application and within
    ActiveX Control Test Container.
    The wizard has made wrapper. This is a fragment from the generated .h-file:

    void ShowAbout()
    {
      InvokeHelper(0x10, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
    }

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support