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

  • SEARCH
  • Home
  • 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 3485388
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:54:06+00:00 2026-05-18T10:54:06+00:00

I have code like this: // Create event handler delegate symbolReader.ReadNotify += new EventHandler(symbolReader_ReadNotify);

  • 0

I have code like this:

// Create event handler delegate
symbolReader.ReadNotify += new EventHandler(symbolReader_ReadNotify);

When a barcode is scanned on my handheld device then symbolReader_ReadNotify is called.

This is a simplified version of that method:

/// <summary>
/// Event that fires when a Symbol scanner has performed a scan.
/// </summary>
private void symbolReader_ReadNotify(object sender, EventArgs e)
{
    ReaderData readerData = symbolReader.GetNextReaderData();

    // If it is a successful scan (as opposed to a failed one)
    if (readerData.Result == Results.SUCCESS)
    {
        // Setup the next scan (because we may need the scanner 
        // in the OnBarcodeScan event below
        Start();

        // Get the handle of the window that the user was on when the scan was sent.
        IntPtr handle = CoreDLL.GetTopWindow();

        // If we have a barcode scanner method for this window then call that delegate now.
        if (_scanDelegates.ContainsKey(handle))
        {
            Action<BarcodeScannerEventArgs> scanDelegate;
            // Get the method to call for this handle 
            // (previously added to the _scanDelegates dictionary)
            bool delegateRetrieved = _scanDelegates.TryGetValue(handle, out scanDelegate);
            if (delegateRetrieved && (scanDelegate != null))
                scanDelegate(e);

        }
    }
}

That works fine most of the time. But when the call to scanDelegate opens a new window that also needs to accept scans the event (symbolReader.ReadNotify) does not fire (when the scan is done on that window). But once the window closes (and scanDelegate(e) returns) the event does fire (but now I route it to the wrong window.

Is there someway to tell the app to send the event? Does it work like windows messages (i.e. there is a way to flush the messages) or is it just the Symbol library that is failing to send the event until it is too late?)

The one thing I have tried is calling Application.DoEvents in a loop in the window that is opened. But that does not seem to work.

Note: This is a Compact Framework app, but I don’t think this is a Compact Framework issue, so I am not tagging it with Compact Framework.

Any advice to get the event to fire when the scan happens (like it does when it is not a nested scan) would be great!

  • 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-18T10:54:07+00:00Added an answer on May 18, 2026 at 10:54 am

    Does the scanDelegate(e) open a the new window as a Dialog? If so it’ll block the event from raising again untill it’s closed because it’s called (opened) from within the same eventhandler.

    You can work around it by either delaying the opening untill after the event is handled, not opening it as a dialog or by opening it on a new thread (or use begininvoke on the delegate)

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

Sidebar

Related Questions

Is there any way that I can create a new delegate type based on
I have an event which I would like to have processed in a parallel
I have two questions. 1) I found a little gem of code for how
I would like to create a dynamic proxy for binding WinForms controls to objects
I have what I think is a simple problem to which I have found
Background I have a Windows service that uses various third-party DLLs to perform work
I've recently created these two (unrelated) methods to replace lots of boiler-plate code in
So I have a Project with a UITabBarController and a few Navigation Controllers, and
I have 3 classes A,B,C . Class A creates B .. class B creates
I'm not really writing an alarm clock application, but it will help to illustrate

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.