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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:43:41+00:00 2026-05-20T19:43:41+00:00

I am using an old COM component (communications class library) in a new C#

  • 0

I am using an old COM component (communications class library) in a new C# application. The COM control handles communication with some of our instruments. One of the functions is to download data, which, depending on the size of data, can be a rather lengthy operation. The new C# app is set up to handle the downloading as a thread. The problem is, when the code is executing the download function, everything else freezes up, so I cannot click a ‘Cancel’ button in the UI. I’ve added a Sleep () (trying everything from 0 to 1000 as params) call to the download code after every block without success. The part that has me confused is if my download thread, instead of calling into the COM control, simply executes an infinite loop in C#, I can cancel out of that because the UI is active. Does anyone have any thought on what I can try to make the download thread yield?

Thanks

  • 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-20T19:43:41+00:00Added an answer on May 20, 2026 at 7:43 pm

    If the threading model of the COM component is STA and you are creating it in the main UI thread and then calling the method to download data from a secondary thread the call will be marshaled and executed back on the UI thread and basically blocking your application.

    STA COM components require to be created in a STA thread that pumps messages because all calls to the component will be marshaled and executed in the thread that created it independently of the thread that actually calls a method on the COM component.

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

Sidebar

Related Questions

I'm using the ProgressBar control in a WPF application and I'm getting this old,
We have some really old code that calls WebServices using behaviours (webservice.htc), and we
I'm using Microsoft.XMLHTTP to get some information from another server from an old ASP/VBScript
I'm trying to rebuild an old metronome application that was originally written using MFC
I'm trying to rebuild an old metronome application that was originally written using MFC
At the team with which I work, we have an old codebase using PHP's
We have an old project written using Managed C++ syntax. I would like to
I have just been re-working an old bit of compiler-like code written using bison.
I'm using VS2008 for a C++ project. The code is quite old and has
Using online interfaces to a version control system is a nice way to have

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.