You want to automatically create a wrapper class for an existing activeX control so you can call the methods and set properties from GuiXT.

Use the Windows Forms ActiveX Control Importer-Tool (Aximp.exe) with the /source option to create C# code.

We embed the windows media player control into the screen, play a video from a local file.

We then also set the properties of the control to hide the control panel:

Find the library and call Aximp.exe

Start the command prompt for visual studio and go to a directory in which you want to have the new files created. Then type "aximp.exe /source 'path to the library'.

For the windows media player we use:

More information can be found here:

Modify the created c# file

With GuiXT we can create new activeX controls and embed them on the screen or we can modify existing ones. In both cases GuiXT can give us a reference to the object that we can use as a parameter for our library.

The standard task that we need to do is:

- add a reference to guinet.dll to the project
- add a guixt variable to the class
- compile as classlibrary and put the .dll file into the GuiXT .NET classlibraries path

 In our example we also add two methods so we can set and read properties by name.
You can download the modified class here:AxWMPLib.cs

Event handling

You can just add your own code inside the event handlers. For example, we can set a GuiXT variable when the user clicks inside the media player control:

 internal void RaiseOnMouseDownEvent(object sender, 
        _WMPOCXEvents_MouseDownEvent e)
            "Mouse clicked!");

        if ((this.MouseDownEvent != null))
            this.MouseDownEvent(sender, e); 


GuiXT script

Pushbutton  (2,88) "Play Tutorial 1"  process="test_play_video.txt"

        (2.7,87.7)     (14.6,143.2)          progID="WMPlayer.OCX" _
name="myplayer"   -silent


InputScript script

// Reference to the control
mycontrolsCsharp.AxWindowsMediaPlayer.init "&V[myplayer]"

 // Load and play video
mycontrolsCsharp.AxWindowsMediaPlayer.SetProperty _
"URL" "D:\videos\computer.mp4" 

// Hide the controls of the media player
  mycontrolsCsharp.AxWindowsMediaPlayer.SetProperty  _
"uiMode" "none"

Components InputAssistant + Controls