/ActiveX

Performing ActiveX operation

Primary LanguageJavaScript

ActiveX

ActiveX is a Microsoft-created technology that enables different software applications to share information and functionality. ActiveX only works with Microsoft applications like Word, Excel, Internet Explorer and PowerPoint, and will only work on a computer running the Windows operating system.

Prerequisites

  • Internet Explorer(IE)
  • ActiveX only works at Internet Explorer(IE).

  • Enabling ActiveX in IE
    1. IE has to be opened as "Run as Administrator" mode.
    2. Go IE settings-> internet options-> security tab-> custom level -> Initialize and Script ActiveX controls not mark as safe for scripting (mark it enable)

Open a .txt file from browser using ActiveX

  • In order to open a txt file, a txt file(named as Notepad) has to be created in C drive
  • Open ActiveX page
  • Click the button "ActiveX File Calling"

Call a DLL file from browser using ActiveX

  1. "ActiveXClass.cs" class has to be putted in "C:\Windows\Microsoft.NET\Framework\v4.0.30319" directory.
  2. Then we have to make a dll of this class in that directory and then register that created dll. To do this:
    1. run command prompt(Admin)
    2. cd C:\Windows\Microsoft.NET\Framework\v4.0.30319 [go to the directory]
    3. csc /target:library /out:ActiveXClass.DLL ActiveXClass.cs [create dll of that class]
    4. regasm ActiveXClass.dll /tlb /codebase [register dll]
    5. csc /out:ActiveXClass.DLL /reference:MathLibrary.DLL ActiveXClass.cs [only necessary if the dll has reference of other dll and then we will use this line instead of line 4 ]