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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:18:17+00:00 2026-05-16T07:18:17+00:00

I have a function, singleFrameEventHandler, that I wish to be called when a certain

  • 0

I have a function, singleFrameEventHandler, that I wish to be called when a certain event, OnNewFrame, occurs. After doing some research, it seemed to me that functions which handle events have a void return type and take a parameter of the type that contains the event. From what I could find online, that is done like this:

Function declaration:

void singleFrameEventHandler(IAFrame ^ frame);

When the function is assigned to handle the event:

iaframe->OnNewFrame += &singleFrameEventHandler;

When I try to compile the code containing the above segments, I get the following error:

error C2664: 'Spiricon::BeamGage::Automation::Interfaces::IAFrame::OnNewFrame::add' : cannot convert parameter 1 from 'void (__clrcall *)(Spiricon::BeamGage::Automation::Interfaces::IAFrame ^)' to 'Spiricon::BeamGage::Automation::Interfaces::newFrame ^'
No user-defined-conversion operator available, or
There is no context in which this conversion is possible

The OnNewFrame is of type Spiricon::BeamGage::Automation::Interfaces::newFrame, which unfortunately has no documentation beyond being described as “The event that is called when a new frame is available.”

In the object browser, I can find some information about it:

public delegate newFrame:
    public System.IAsyncResult BeginInvoke(System.AsyncCallback callback, System.Object object)
    public System.Void EndInvoke(System.IAsyncResult result)
    public System.Void Invoke()
    public newFrame(System.Object object, System.IntPtr method)

The newFrame constructor (?) seems to be the best bet, as it appears to take a method pointer, but when I try to use it like this:

iaframe->OnNewFrame += gcnew newFrame(iaframe, &singleFrameEventHandler);

I get the following error:

error C3352: 'singleFrameEventHandler' : the specified function does not match the delegate type 'void (void)'

Does this mean that my function has to take no parameters? If so, how would I get information about the event?

  • 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-16T07:18:17+00:00Added an answer on May 16, 2026 at 7:18 am

    The first syntax cannot work, that’s C# syntax sugar that C++/CLI doesn’t have.

    The problem with the 2nd snippet is that the delegate type doesn’t match the signature of your event handler. The delegate was declared like this:

     delegate void newFrame();
    

    You’ll have to change your method signature to:

     void singleFrameEventHandler() 
     {
        // etc..
     }
    

    How you’re supposed to get a reference to the frame is not clear from your snippets. I’d guess at a property on the class.

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

Sidebar

Ask A Question

Stats

  • Questions 529k
  • Answers 529k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer 1: PIO (programmed IO) thrashes the CPU caches. The data… May 16, 2026 at 11:19 pm
  • Editorial Team
    Editorial Team added an answer scoreField.text = " " + string(currentScore); should be scoreField.text =… May 16, 2026 at 11:19 pm
  • Editorial Team
    Editorial Team added an answer Using plain vanilla JavaScript: Assuming the loading_iframe function performs the… May 16, 2026 at 11:19 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a function that I want to use as an event handler: void
I have function getCartItems in cart.js and I want to call that function in
I have function which takes in an parameter of a class called Triple, and
I have a function that takes a variable number of arguments in C that
I have a function, foo(), that allocates memory and returns it. Is it standard
i have a function called ViewComments() which retrieve contents from database using SQL commands
I have function along these lines: public void view(string msg) { messagebox.show(msg); } .
I have function in Javascript which works fine using prototype. The function is used
i have function <script type=text/javascript> $(function () { $(#search).click(function() { var text = $(#searchText).val();
i have function public Menu Details(int? id) { return _dataContext.Menu.Include(ChildMenu).FirstOrDefault(m => m.MenuId == id);

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.