Linked Questions
85 questions linked to/from How to post messages to an STA thread running a message pump?
0
votes
0
answers
68
views
C# Alternative to background worker for reporting progress and COM interop? [duplicate]
Background:
I'm making a C# application to copy a range of cells into a bitmap image for reporting. All of my users have excel installed on their computer so the Excel COM interop is an easy way to ...
128
votes
6
answers
34k
views
_=> what does this underscore mean in Lambda expressions?
What does an lambda expression like _=> expr mean?
What is the purpose of _ as input to lambda?
Example:
int count = 0;
list.ForEach(_ => count += 1);
76
votes
4
answers
128k
views
Single-threaded apartment - cannot instantiate ActiveX control
I need to get information about applied CSS styles in HTML page. I used AxWebBrowser and iterate IHTMLDOMNode. I'm able to get all the data I need and move the code into my application. The problem is ...
32
votes
5
answers
38k
views
How can I make a background worker thread set to Single Thread Apartment?
I am creating an automated test running application. In this part of the application, I am working on a polling server. It works by constantly polling the web server to determine when a new ...
14
votes
3
answers
5k
views
An MTA Console application calling an STA COM object from multiple threads
Although there are many questions about COM and STA/MTA (e.g. here), most of them talk about applications which have a UI. I, however, have the following setup:
A console application, which is by ...
20
votes
3
answers
6k
views
Which blocking operations cause an STA thread to pump COM messages?
When a COM object is instantiated on an STA thread, the thread usually has to implement a message pump in order to marshal calls to and fro other threads (see here).
One can either pump messages ...
4
votes
3
answers
5k
views
Accessing COM Object From Thread Other Than Main Thread Slow In C#
I have a proprietary COM library that returns an array of integers (in their own proprietary format of course). When I access this array from the main UI thread, all is well and runs quickly. When I ...
4
votes
1
answer
3k
views
Switching between STAThread and MTAThread and memory leaks
While looking for a memoryleak in a vb.net WebService, I detected that finalizers where blocked, and so several objects where never released (e.g. System.Threading.ReaderWriterLock)
Google told me ...
5
votes
1
answer
5k
views
Using CoInitializeEx on WinForms threads
I am working an SDK for a DSLR camera which has the following instructions:
Notes on Developing Windows Applications When creating applications
that run under Windows, a COM initialization is ...
4
votes
3
answers
2k
views
C#4.0 Issues playing .mp3 files over 192kbps using winmm.dll
MCIERR_INTERNALI am trying to make a simple Media player inside an app, but I've noticed that my code WILL NOT play music unless the file is a low bitrate around 192kbps or less. The issue is that ...
1
vote
2
answers
2k
views
Calling method on correct thread when control is created in new Thread()
I've created a new WebBrowser() control in a new Thread().
The problem I'm having, is that when invoking a delegate for my WebBrowser from the Main Thread, the call is occurring on the Main Thread. ...
2
votes
4
answers
907
views
Program can run as a service or a form - should main thread be MTA or STA?
We have a program that can run as a service or as a winforms app. We do different behaviour based on command line parameters passed in.
If we are running as a form, I think we want our entry point ...
5
votes
1
answer
3k
views
C# Marshalling COM objects between threads
I'm getting very confused about whether C# marshal's COM objects between threads. To this end I have an application which is loading a set of files in a task parallel fashion. I'm using the ...
2
votes
1
answer
4k
views
WebBrowser control in a class library
So as the title suggests, I'm trying to use WebBrowser control in a class library. I've gone through several SO questions like this excellent post, but the unique thing in my situation is that the ...
0
votes
1
answer
2k
views
How to handle Win32 WndProc messages in .Net 6?
I'm using .Net 6 and the PInvoke nuget package to access the Win32 API and I'm creating a Win32 window in the following way:
IntPtr windowHandle = User32.CreateWindowEx(User32.WindowStylesEx....