Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 258831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:12:48+00:00 2026-05-11T22:12:48+00:00

I have an ActiveX control (an OCX file) which raises an event. I want

  • 0

I have an ActiveX control (an OCX file) which raises an event. I want to catch that event in C#. How do I go about doing it?

I can catch the control’s event in JavaScript, here is the code for that

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body >
<script type="text/javascript" for="CRMCntrl1" event="NewCall(szCallID, szCallType, nCallStartTime, szCLI, szOtherInfo)">       
        document.getElementById("abc").innerHTML="CallID: " + szCallID + "</br>" +
            "CallType: " + szCallType + "</br>" + 
            "CallStartTime: " + nCallStartTime + "</br>" +
            "CLI: " + szCLI + "</br>" + 
            "OtherInfo: " + szOtherInfo + "</br>" ;

</script>
<p>
<object id="CRMCntrl1" classid="clsid:D26FE0DF-5CAC-44E4-AA7A-E1794D9634D1">
</object>
</p>
<div id="abc">
</div>
</body>
</html>

I want to do it in C#. So I added a COM reference of the control. It contains interfaces which I implemented in my Form’s class. In one of the interface there is an event, I subscribed to that event, basically it is the event which I want to capture, but it isn’t raised.

Here is my C# Code

// other namespaces here
using CRMCNTRLLib;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form, CRMCntrl
    {
        public Form1()
        {
            InitializeComponent();

            this.NewCall += new _DCRMCntrlEvents_NewCallEventHandler(this.OnNewCall);
        }

        public event _DCRMCntrlEvents_NewCallEventHandler NewCall;

        public void AboutBox()
        {
            MessageBox.Show("steadfast");
        }

        public void OnNewCall(string szCallID, string szCallType, int nCallStartTime, string szCLI, string szOtherInfo)
        {
            MessageBox.Show(szCallID + szCallType + nCallStartTime + szCLI + szOtherInfo);
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T22:12:48+00:00Added an answer on May 11, 2026 at 10:12 pm

    From your code it seems like CRMCntrl is an interface with a single NewCall event. So if you want to implement that interface, then you are the one who is responsible for firing the event, not handling it.

    To handle an event fired from your ActiveX control, you need to use the instance of your actual control – that is where the event should come from. If you added the control using the designer, try to find what is the name of the private field which contains a reference to your control.

    Somehow you will need to change this:

    this.NewCall +=
           new _DCRMCntrlEvents_NewCallEventHandler(this.OnNewCall);
    

    to this:

    myActiveXControl.NewCall +=
           new _DCRMCntrlEvents_NewCallEventHandler(this.OnNewCall);
    

    where myActiveXControl is the name of your control (which also implements the interface providing the event).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ActiveX control that I'm loading with JavaScript in Internet Explorer. It
I have an ActiveX control (written in Delphi) which I want to host in
I have a requirement to have an event that calls an ActiveX control from
I have an activeX control, that ask the user if he want's to install
I have a CAB file that contains a few DLLs, and an OCX ActiveX
I have an ActiveX control that runs on a website, where the old version
I have an ActiveX control written in C++ that runs in Internet Explorer 8.
I have got an ActiveX Control that gets an image from a fingerprint device
I have a 3rd party ActiveX control I want to render within other presentation
I have the unenviable task of maintaining an ActiveX control that expects OLE_Colors as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.