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
1 answer

STA threading exception in a Wpf application

I have a wpf application like this : public CreateProject() { InitializeComponent(); _3DCAO.Temporary3DCAO.Close = false; Userinitial fen = new Userinitial(); container.Content = fen; …
Lamloumi Afif
  • 8,941
  • 26
  • 98
  • 191
0
votes
1 answer

Creating a save dialog in the same thread as the main window

I was wondering if there was any easy way to have the save file dialog run in the same thread as the main window of my program? private void saveAs_click(object sender, EventArgs e) { System.Windows.Forms.SaveFileDialog saveDiag = new…
Samuel French
  • 665
  • 3
  • 11
  • 22
0
votes
2 answers

How to force MTA on all threads calling from 3rd party unmanaged process into managed plugin?

I am trying to write a managed plugin to an unmanaged host application using COM interop. The unmanaged plugin interfaces are all COM compatible although no COM is used (no registry etc). I have come a long way to get it to work there is just one…
obiwanjacobi
  • 2,413
  • 17
  • 27
0
votes
1 answer

F# WPF Attributes have been ignored in this construct

So. I was following along some tutorials on using WPF with F# blog here. I am working with the second one. Since I am trying to learn F# WPF for larger more enterprise applications, it doesn't make much sense for me to use a bunch of F# script…
Alexander Ryan Baggett
  • 2,347
  • 4
  • 34
  • 61
0
votes
1 answer

Implementation Secure messaging in EHR through Direct protocol

I'm working on EHR secure messaging in ASP.NET. I have already configured the direct project on virtual machine. Now I have no clue where to start, I want to integrate my EHR application with STA/HISP in order to achieve secure messaging. Is there…
Nomi Ali
  • 2,165
  • 3
  • 27
  • 48
0
votes
1 answer

Exception: Single Thread Apartment (STA) in asp.net website

I have these methods in an asp.net web form: public partial class currencies : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } public class Rate { public string to { get; set; } public string from { get; set;…
FeliceM
  • 4,163
  • 9
  • 48
  • 75
0
votes
1 answer

Getting Hash from command line arguments

I am trying to create a console or form where you would drag a file onto their respective .exe The program would get that file and hash it, then set the clipboard text to the proviously generated hash. This is my code using System; using…
Dean
  • 17
  • 8
0
votes
3 answers

Calling a method in WPF code behind which is not UI specific

Am having a method public void selectingTab(string name) { //Code to select a particular tabitem in the XAML based on the parameter name }` in my WPF code behind and in my XAML page, i have a tab control.The parameter of the function specifies…
Dhivya Sadasivam
  • 155
  • 2
  • 2
  • 14
0
votes
0 answers

Cannot use AutoResetEvent.WaitOne() and Thread.Sleep in STAThread

In my program, the main function starts a background thread which creates an object that I need in the UI thread (uses Windows Forms, thus marked [STAThread]). Simplified code: internal static MyDependencyInjectionKernel kernel; internal static…
AndiDog
  • 68,631
  • 21
  • 159
  • 205
0
votes
1 answer

STA thread throws InvalidOperationException

This is the situation: I have a class that implements a HTTP server in my application, so I can take requests. The goal of this server is to refresh a graph using an XML sent to the application. The XML parser that I have written uses a UserControl…
DrGrijando
  • 109
  • 2
  • 8
0
votes
1 answer

WebServer Crashes on STA Thread Join wih axinterop

I am trying to use AxInterop.Mydll.dll in a project. I have called the function in a new thread with STA. Everything goes fine does my work and on return after a second or so Webserver crashes and even on hosting iis is restarted.
serene
  • 685
  • 6
  • 16
0
votes
2 answers

Why does putting [STAThread] on Program.Main in XNA game with slow FPS prevents restoring on minimize?

The symptom I'm trying to resolve is that my XNA application will not restore some of the time after being being minimized. I click the minimize button, but when I click on my application's entry in the task bar, the application does not resume -…
Victor Chelaru
  • 4,491
  • 3
  • 35
  • 49
0
votes
1 answer

WCF (WPF) error: calling thread must be STA

I receive some data from a service reference. The structure f.e. is as follows: I receive some driverdata from the service reference (namespace: ServiceReference.Driver) The namespace of the driverdata in my project is…
Kjell Derous
  • 502
  • 1
  • 6
  • 19
0
votes
1 answer

Duplex WCF + Static Collection of COM objects

I am trying to build a WCF service that exposes the functionality of a particular COM object that I do not have the original source for. I am using duplex binding so that each client has their own instance as there are events tied to each…
Benny
  • 3,899
  • 8
  • 46
  • 81
0
votes
0 answers

Accessing Office Clip Board using C#.net

I use Visual Studio 2005 to develop a "Windows Service" using c#.net. My code requires to access the MS office Clipboard. But on trying to access the Clipboard class, the debugger throws an error "Current thread must be set to single thread…