Search code examples
wmiactivexopenedgeprogress-4gl

Which ActiveX control (*.ocx file) handles WMI?


Yesterday I asked this question about launching a commandline in OpenEdge Progress-4GL and catching the results.

Although it works fine, I wonder why I would not simply use a WMI API instead: as described in this webpage about WMI API this is possible for a Windows related programming environment, handling ActiveX objects (see "Developer audience" chapter).

I'm working in OpenEdge Progress-4GL, release 11.6, using the AppBuilder. This makes it possible to add an ActiveX control on a window, but the list of available controls does not mention any WMI (or Windows Management) related control, so I assume I need to browse for it on my computer (or download it), and here's the question:

Which *.ocx file covers WMI API (and how can I use it)?

Edit after comment on first answer: Appbuilder's Tools menu

This is what my AppBuilder's "Tools" menu looks like:

enter image description here

Thanks in advance
Dominique


Solution

  • First, as Mike mentioned, do not bother going down the ocx road.

    The System.Management.ManagementScope class is located in the .Net System.Management.dll. To use a .Net dll it needs to be added to the assembly.

    Important notice for AppBuilder users

    Some developers start their development, working with the AppBuilder (the shortcut, starting the development, contains C:\Progressx86\OpenEdge\bin\prowin32.exe ... -p _ab.p ...). Starting the procedure editor from this point won't work, as some menu items will be missing.
    In order to cope with this, start working with C:\Progressx86\OpenEdge\bin\prowin32.exe (without any parameters). This will start up the procedure editor, containing the needed menu items.

    With Progress Developer Studio for OpenEdge you just add it and then you can use it. Adding the assembly via the GUI results in the following assemblies.xml:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <references>
    <assembly name="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    </references>
    

    When you have this assemblies.xml, you can just use:

    DEFINE VARIABLE oMgmtScope AS System.Management.ManagementScope NO-UNDO.
    

    To add assemblies without Progress Developer Studio for OpenEdge you can use the procedure editor, menu entry [ Tools / Assembly References ]:

    enter image description here

    After which you can add references:

    enter image description here