0

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

Dominique
  • 16,450
  • 15
  • 56
  • 112
  • Is there a reason why you want to use Active X? It's dead end technology since decades. I'd rather try to adopt a .NET/C# WMI sample like this here: https://nathondalton.wordpress.com/2015/02/03/c-wmi-tutorial/ – Mike Fechner Dec 31 '20 at 08:55
  • @MikeFechner: I've tried to follow the instruction in the mentioned URL and tried to translate it to Progress language but that failed (error 5638): `DEFINE VARIABLE oMgmtScope AS System.Management.ManagementScope NO-UNDO.`, how can I get this done? – Dominique Dec 31 '20 at 10:25
  • See this thread: https://stackoverflow.com/questions/4193883/where-are-my-system-management-classes you'll have to add an Assembly reference. In ABL this is done via a file assemblies.xml in the working directory of your AppBuilder session. This should do: – Mike Fechner Dec 31 '20 at 15:14

1 Answers1

1

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

Dominique
  • 16,450
  • 15
  • 56
  • 112
Stefan Drissen
  • 3,266
  • 1
  • 13
  • 21
  • I'm working using the AppBuilder, so without Progress Developer Studio. I'm currently adding some functionality to the "SPORTS" database, the basic example, delivered with Progress software. Do you know where to find the external references in there? – Dominique Jan 04 '21 at 11:12
  • https://knowledgebase.progress.com/articles/Article/000046107 - menu [ Tools / Assembly References ] – Stefan Drissen Jan 04 '21 at 11:42
  • I've added the "Tools" menu screenshot in my original question. As you see there's no "Assembly References" menu item there. – Dominique Jan 04 '21 at 11:51
  • It seems the menu entry was only added to the procedure editor (prowin.exe / prowin32.exe). – Stefan Drissen Jan 04 '21 at 13:14
  • Your version of the Procedure editor contains following menu chapters: "File", "Edit", "Search", "Buffer", "Compile", "Tools", "Options" and "Help. Mine only contains "File", "Edit", "Search", "Compile" and "Help". So, the "Tools" part is not there (neither are the "Buffer" and "Options"). – Dominique Jan 04 '21 at 13:25
  • Are you using customized ADE source code? The procedure editor is also Progress source code. Looking at https://github.com/consultingwerk/ADE-Sourcecode/blob/master/src/adecomm/toolmenu.i and https://github.com/consultingwerk/ADE-Sourcecode/blob/master/src/adeedit/dmenus.i I see no reason why you are missing menu options. – Stefan Drissen Jan 04 '21 at 17:04
  • I /think/ that you have selected [ Tools / New Procedure Window ] from the AppBuilder? There I also do not have buffers / tools / options. Try [ Tools / Procedure Editor ] – Stefan Drissen Jan 04 '21 at 17:07
  • From where? When I start up my "environment", it's the AppBuilder I see. I start up my environment using a shortcut `C:\Progressx86\OpenEdge\bin\prowin32.exe -basekey "INI" -ininame progress.ini -p _ab.p -pf c:\sports\misc\sports.pf`, the "[startup]" part of the ini-file contains (amongst others) the following entries: "V6Display=no, UseSourceEditor=yes, EditorConfigPath=C:\OpenEdge\WRK\proedit". – Dominique Jan 05 '21 at 07:37
  • I'm sorry, but I'm not available for a longer time, therefore I prefer continue having this discussion in comments (or by editing the question). If this is ok for you, can you tell me which information you need from me to carry on? – Dominique Jan 05 '21 at 10:15
  • 1
    Start prowin32 without any other parameters, this will start the vanilla procedure editor. – Stefan Drissen Jan 05 '21 at 11:11
  • Did you miss my comment regarding starting the procedure editor vs new procedure window? – Stefan Drissen Jan 05 '21 at 12:31
  • It's not that I missed your comment, but at that moment the only way I knew to open the procedure window was to open a new one (I only work here for two weeks, hence my ignorance). – Dominique Jan 05 '21 at 12:36