Skip to Content

Hello community,


in my last blog posts here, here and here I showed different scenarios of COM development integration – all with ABAP in Eclipse. To increase the integration I developed a library which delivers the complete interfaces of all methods and properties of a COM library. The library calls TypeLibInf.dll.


TypeLibInf library offers three ways of information to the interface information of a COM library:

  1. Via StdCall interface
    Function DLL_TypeLibInf (TypeLibName As String Ptr) Export As Long
    TypeLibName = Path and name of the type library
    Delivers the address to a string with the interface information
  2. Via Java interface
    Delivers a string with the interface information
  3. Via COM interface
    Delivers a string with the interface information


You can use it via Java e.g. like this:

// Begin----------------------------------------------------------------

  public class TypeLib

    public native String Inf(String s);


    public static void main(String[] args)
      TypeLib TL = new TypeLib();
        String Interface = TL.Inf("C:\\Windows\\System32\\wshom.ocx");
      catch (Exception e)


// End------------------------------------------------------------------


Also you can use it via COM e.g. like this:


  Set TypeLibInf = CreateObject("COM_TYPELIBINF")
  If IsObject(TypeLibInf) Then
    Interface = TypeLibInf.COM_TYPELIBINF("C:\Dummy\COMBeep.dll")
    MsgBox Interface
    Set TypeLibInf = Nothing
  End If



Also I developed as example a tiny program which uses the StdCall interface of the library. It shows all methods and properties of a COM/ActiveX library in a tree, below their interfaces. With a double click on the method or property the program generates an associated ABAP code. Also you can see the interface definition with all arguments and their types.




I hope in this way it is much more easier to developing ABAP programs with COM/ActiveX connection.

I integrate the Java interface for a future development, to integrate the same functionality as view for ABAP in Eclipse.


Here a snippet to use TypeLibInf in ABAP:

  Program zTypeLib.

    Type-Pools OLE2.

    Data TypeLibInf Type OLE2_OBJECT.
    Data Interface Type String Value ''.
    Data TabInterface Type Table Of String.
    Data strTemp Type String Value ''.

    Create Object TypeLibInf 'COM_TYPELIBINF'.
    If sy-subrc = 0 And TypeLibInf-HANDLE <> 0 And
      TypeLibInf-TYPE = 'OLE2'.

      Call Method Of TypeLibInf 'COM_TYPELIBINF' = Interface
          #1 = 'C:\Windows\System32\wshom.ocx'.                  "32-bit
         "#1 = 'C:\Windows\SysWOW64\wshom.ocx'.                  "64-bit

      Split Interface At ';' Into Table TabInterface.
      Loop At TabInterface Into strTemp.
        Write: / strTemp.

      Free Object TypeLibInf.



Here a snippet to use TypeLibInf in Python:


from ctypes import *

TypeLibDLL = "C:\\Projects\\TypeLibInf\\TypeLibInf.dll"
TypeLib = windll.LoadLibrary(TypeLibDLL)

TypeLib.DLL_TypeLibInf.argtypes = [c_char_p]
TypeLib.DLL_TypeLibInf.restype = c_char_p

Lib = create_string_buffer(b"C:\\Windows\\System32\\wshom.ocx")   #32bit
#Lib = create_string_buffer(b"C:\\Windows\\SysWOW64\\wshom.ocx")  #64bit
Interface = TypeLib.DLL_TypeLibInf(Lib)

Interface = str(Interface)
lstInterface = Interface.split(";")
for i in range(len(lstInterface)):

del TypeLib



Here a snippet to use TypeLibInf with PowerShell:


  #-Sub Main------------------------------------------------------------
  Function Main() {

    $TypeLib = New-Object -ComObject "COM_TYPELIBINF";
    If ($TypeLib -isnot [__ComObject]) {

    $Files = Get-ChildItem -Path "C:\Dummy\" -Include @("*.dll","*.ocx") -Recurse;
    ForEach ($File In $Files) {
      $Interface = $TypeLib.COM_TYPELIBINF($File.Fullname);
      $Interface = $Interface.Replace(";", "`r`n");
      $NewName = $File.Fullname + ".int";
      $Interface | Out-File $NewName;





You can download the library and the program with the examples here.


2014/08/28 – Tiny update of the program, small bug fixing in ABAP code generation (Thanks to Holger) and the most variable types are now identified in ABAP code generation.

2014/08/25 – Tiny update of the program, now instantiation of OLE object in ABAP code generation with subrc request.

2014/09/08 – Tiny update of the program, small bug fixing in ABAP code generation and some advances to the program itself.


Enjoy it.




To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply