NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Win Forms ActiveX Control Importer (aximp.exe)

The ActiveX Control importer is responsible for converting the type definitions found within the COM type library for an ActiveX Control into a Win Forms Control.

Win Forms can only host Win Forms Controls - that is classes that are derived from System.WinForms.Control. In order to host an ActiveX Control on a form it must appear to be a Win Forms Control. Conversely an ActiveX Control expects to be hosted in an ActiveX Control Container.

In order to achieve hosting there is a base class System.WinForms.AxHost that derives from System.WinForms.RichControl. This control is a Win Forms control “on the outside” and an ActiveX Control Container “on the inside”.

In order to host the ActiveX Control you need to generate a “wrapper” control that derives from System.WinForms.AxHost. This generated control hosts the ActiveX Control and exposes its properties methods and events (PMEs) as PMEs of the generated control.

Conversions are done for an entire ActiveX Control type library at one time. You cannot use aximp to generate type information for a subset of the types defined within a single type library. The output of aximp is a set of binary files that contain the NGWS runtime metadata and control implementation for the types defined within the original type library. The generated files are named according to the following pattern:

NGWS runtime proxy for COM types: <progid>.dll

Win Forms proxy for ActiveX Control: <progid>WFC.dll

(where WFC signifies Win Forms Control)

You can examine these files with tools such as Ildasm.exe.

PDC Tech Preview Warning:  If the name of the COM type library progid has the same name as the output proxy name – for instance SHDOCVW.DLL – then the original type library may be overwritten. Do not use aximp in the directory that contains your type library.

Syntax

aximp TlbFile 

Example

The following example generates shdocvw.dll and shdocvwwfc.dll for the Web Browser control:

aximp c:\winnt\system32\shdocvw.dll

In C# you would use this code:

Namespace MyControls {
    using System;
    using System.WinForms;
    using SHDocVwWFC;
    public class MyControl: System.WinForms.Form {
        private System.ComponentModel.Container components;
        private SHDocVwWFC.AxWebBrowser AxWebBrowser1;

        public MyControl () : base() {
            InitializeComponent();
AxWebBrowser1.Offline = true ;
      }
…
      }
…
}

and compile it as follows:

csc /debug+ /r:System.DLL /r:System.WinForms.DLL  /r:Microsoft.Win32.InterOp.DLL /r:ShDocVwWFC.DLL /out:MDIBrowser.exe *.cs.c

See Also

NGWS Runtime IL Disassembler