Questions tagged [sta]

Single-Threaded Apartment of the Component Object Model (COM), as opposed to MTA

STA refers to the Single-Threaded Apartment of Microsoft's Component Object Model (COM). Its opposite is the Multiple Threaded Apartment (MTA), but there is also a Neutral Apartment.

Related tags:

References:

230 questions
-1
votes
1 answer

Using async in static context to update the UI is not working

I am using the following code public static class Program { [STAThread] public static void Main(string[] args) { CancellationTokenSource tokenSource = new CancellationTokenSource(); Task timerTask =…
Thomas Flinkow
  • 4,845
  • 5
  • 29
  • 65
-1
votes
1 answer

How do I determine the internal HWND used by COM in my current process?

I want to Post messages directly to the HWND that's owned by COM in my process. How do I get the HWND that COM is using in single-threaded-apartment mode?
zumalifeguard
  • 8,648
  • 5
  • 43
  • 56
-1
votes
1 answer

C# STAThreads not being cleaned up - OutOfMemory exception

I have a console application which takes as input a folder, picks up all the files in that folder and process them. The processing is sequentially and for each document it launches a separate STAThread that runs a WPF dependent action inside it.…
virlan2004
  • 243
  • 1
  • 5
-1
votes
1 answer

Need help getting access to Clipboard to work from MTA application

I just am changing a GUI application from STAThread to MTAThread as it does some parallel background work. Now I encountered the issue of accessing the Clipboard from within a MTAThread application. I tried to create a dedicated STA thread on my…
Nicolas
  • 754
  • 8
  • 22
-2
votes
2 answers

"The calling thread must be STA, because many UI components require this."

I am trying to get a window to open in plain C#. I've created, for this, a window constructor (SGFWindow) extending the Window class from System.Windows : namespace SGF { public partial class SGFWindow : Window { public SGFWindow() …
Soetch
  • 19
  • 3
1 2 3
15
16