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
0
votes
0 answers

Powershell Scipt Runs in ISE only

I have researched this question quite a bit and have found others with similar issues, but no fix that works for us. We have built a power shell script to monitor a folder for new images, check their color profile with exiftool and convert when…
Garrett
  • 617
  • 12
  • 30
0
votes
2 answers

Trying to understand a logreader

I am trying to understand some code. It is a small program that prints out log data. It is done by creating a form with a DataGridView that is filled by a DataTable. The form class also has a refresh function (RefreshPresentation). The BusinessLogic…
Kasper Hansen
  • 6,307
  • 21
  • 70
  • 106
0
votes
1 answer

STA thread for dialog boxes

To use dialog boxes in windows form applications either the main thread should be set as [STAThread] or a separate STA thread needs to be created for the dialog box to run on. Here comes the issue I could not realy understand. A started STA thread…
tarpista
  • 99
  • 10
0
votes
1 answer

WPF Recreation window in different STA thread

I need to create window with loading gif when my main window is rendering. I have read some articles and make a decision that for this purposes i need to create new thread. I did it like in this article As a result I have something like…
0
votes
0 answers

How to know if two COM proxies proxy the same COM object

I have two STA threads that make calls to a COM server and so I get back two different COM proxy pointers to the same COM object. Is there a way check equality in this case given pointer comparison is out of the question?
noztol
  • 494
  • 6
  • 25
0
votes
1 answer

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

I just added an ElementHost to a windows Form(There are some other c# code in the Form). Then it gave me the error "The calling thread must be STA, because many UI components require this." I changed the thread to STA, but it blocked other…
Sen
  • 85
  • 1
  • 1
  • 5
0
votes
0 answers

CLR exception STAThread attribute required for ElementHost in WinForms app

I have a WinForms VB app, using Visual Studio 2010. I am using the WPF DocumentViewer, so it is hosted by the ElementHost control. In my AppMain_Form.Designer.vb, when the follopwing (generated) statement is executed: Me.rv_doc_vwr_host = New…
Radagast
  • 1
  • 1
0
votes
0 answers

STA in .NET based COM interOp DLL

I have aDLLbased in .NET which I expose to native applications using COM. It seems to run fine most of the time, however, using logs, I have seen that on some occasions, the DLL, when doing some work for an application, say Application A, gets…
user1173240
  • 1,455
  • 2
  • 23
  • 50
0
votes
0 answers

Handle blocking COM call in GUI thread

I'm implementing a C++ library that wraps a COM library (IMAPI) to more easily provide the functionality throughout our applications. It contains wrapper classes for the various interfaces of IMAPI. These are instantiated in the GUI thread of a…
Robert
  • 767
  • 8
  • 17
0
votes
1 answer

OpenFileDialoug Current Thread Must Be STA before OLE calls made

Can someone explain to me what this error I'm seeing is? Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Specifically, I'm trying to open the SaveFileDialog/OpenFileDialog within C++/CLI on a…
0
votes
1 answer

WPF user control crashes with 'The calling thread must be STA'

The Code Behind of a WinForm is crashing with The calling thread must be STA, because many UI components require this., when trying to create a WPF user control, using myWpfUserControl = new MyWpfUserControl();. It seems to be crashing in the base…
wezten
  • 2,126
  • 3
  • 25
  • 48
0
votes
1 answer

STA not recognized in Slim (FitNesse)

I wrote a custom table class for Slim that lets users write commands that are used to run automated tests. All commands are now working, except for one that relies on a certain call that has to be made in an STA thread. I was able to solve this…
Samuel
  • 11
  • 1
0
votes
1 answer

Startup Parameters within the Script?

I have a script that needs to run in single-threaded mode, and I currently start it up with the -sta parameter with a batch. Is it possible to run the script in -sta mode only executing the Script? I thought about moving the whole script into one…
Zombie
  • 13
  • 4
0
votes
0 answers

ASP.NET : The calling thread must be STA, because many UI components require this

I have a WPF class file (.DLL) which opens a webbrowsercontrol and returns some value. I have used this as a reference in an ASP.NET website ... but i get the below error when the code hits the webbrowsercontrol. The calling thread must be STA,…
Telson Alva
  • 842
  • 6
  • 22
  • 37
0
votes
3 answers

IoC and User Interfaces

I'm trying to wrap my head around the best way to use IoC within my application for dependency injection, however I have a little issue. I am using a loose implementation of the MVP pattern with a WPF app. Essentially, a presenter class is…
Matthew Savage
  • 3,794
  • 10
  • 43
  • 53