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 669833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:11:39+00:00 2026-05-14T00:11:39+00:00

I am building a small activex control. I understood that activex cannot call a

  • 0

I am building a small activex control. I understood that activex cannot call a javascript function directly, but needs to work through events. Therefore I’ve created an event, copied from a code sample from codeproject.

The event seems to work only on certain circumstances: It works when a call is made to a javascript function which immediately raises the event. It does not work when my javascript function calls an activex method that performs long operation and only than raise the event, here is an example of what I mean:

Activex event:

[Guid("68BD4E0D-D7BC-4cf6-BEB7-CAB950161E79")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ControlEvents
{
    //Add a DispIdAttribute to any members in the source interface to specify the COM DispId.
    [DispId(0x60020001)]
    void OnClose(string redirectUrl); //This method will be visible from JS
}

Example of the call that works:

    [ComVisible(true)]


public void Close()
    {
        if (OnClose != null)
        {
            OnClose("my test"); //Calling event that will be catched in JS
        }
        else
        {
            MessageBox.Show("No Event Attached"); //If no events are attached send message.
        }
    }

An example of the call that fails:

[ComVisible(true)]
        public void Open()
        {
            try
            {
                Start();
            }
            catch (Exception e)
            {
                throw e;
            }
        }

With the function Start calling a very lengthy method that in turn raises events once every few minutes and send information back to javascript.

I can’t seem to understand why it won’t work. What’s missing? I am sorry if the question is not clear, the error I am getting is not clear either so just ask and I’d refine the question.

  • 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-14T00:11:40+00:00Added an answer on May 14, 2026 at 12:11 am

    I don’t see any event declare in your code. Something should be

    public delegate void EvenHanderDelegate(string redirectUrl);

    public event EnvenHanderDelegate OnClose;

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

Sidebar

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.