mta

STA or MTA for indirectly used COM Objects

孤街浪徒 提交于 2019-12-24 18:15:20
问题 I think I understand the apartment concept and why STA or MTA is used, however a question came up for which I found no solution so far. If my application uses COM Objects under the hood, for example from third party libraries, how do I know if I can use MultiThreaded-Appartment (MTA)? In that case, I have no Idea if those objects are thread safe, so do I need to go with STA, just to be on the safe side? 回答1: Your ability to use certain COM interface pointer on STA or MTA thread code depends

Is possible having two COM STA instances of the same component?

有些话、适合烂在心里 提交于 2019-12-23 02:40:51
问题 I had a problem discovered on another thread here, I need to access a COM component that is STA. I'll run it on a dual-core computer, a process using this component only reaches 50% of CPU. Unfortunately, the owners said they can't change the component to MTA, because the component is a hybrid system compiled at Matlab, which core is C. So I tried to load two instances of the COM class on the same process, different threads accessing it, but I couldn't, only the last COM instance becomes

Winforms: One COM object needs an STAThread, the other needs an MTAThread. How can I use them?

让人想犯罪 __ 提交于 2019-12-22 17:39:40
问题 I'm trying to build a Winforms application with two COM components. However, one of the components only works when using [MTAThread] and the other only works with [STAThread] . What would the recommended solution be? 回答1: Windows forms requires [STAThread] to be present on it's main entry point. It will only work in Single threaded apartment state. You can use your STA COM object on the UI thread in Windows Forms, with no issues. The typical approach for this is to create your own thread, and

COM outbound call results in “An outgoing call cannot be made since the application is dispatching an input-synchronous call.”

守給你的承諾、 提交于 2019-12-20 10:24:03
问题 I have a COM server (C++/STA (MFC based app)) and a COM client (C#/MTA). The COM server must live in an STA, since it's an MFC app (I have no choice in this matter). The client issues a call to the server, and the server issues a callback to the client. That's where the error happens ( RPC_E_CANTCALLOUT_ININPUTSYNCCALL ). I'm guessing if the server had been an MTA, this problem would never have arised, but sadly, the documentation for MFC explicitly denies initializing the apartment as an MTA

Difference between multi-threading vs multi-threading apartment?

烂漫一生 提交于 2019-12-12 03:39:44
问题 I am doing Multi-threading in single threaded apartment(STA) application. I am making an app that will load lot of data to the application which is making the application do not respond for long time. So I used multi-threading so that the application responds while loading so user can use other functionalities in it that are not related to loading data. My question is am I doing MTA inside STA application or just doing multi-threading in STA application? If so what is the difference between

MSTest setting Apartment Threading to MTA

北城以北 提交于 2019-12-10 13:31:02
问题 I'm using MSTest in Visual Studio 2010 on a project that needs the apartment threading model set to MTA. I've looked online and the items I've found and tried seem to only work with Visual Studio 2008 and 2005, see http://blogs.msdn.com/b/ploeh/archive/2007/10/21/runningmstestinanmta.aspx. Thanks 回答1: You're right, most of the information online is out of date. I eventually found Microsoft's documentation: How to: Run Unit Tests in MTA mode You need to open your .testsettings file in an XML

MTA for receiving mails, in PHP

女生的网名这么多〃 提交于 2019-12-10 12:16:47
问题 is there a library/class/code-snippet/etc. that allows me to directly receive mail in php? So that I don't have to run an additional sever in an other process and then have to somehow send the mails to the already-running php-process. I've been looking around for a while, but results for "php" and "mail" or "mta"/"smtp" on google focus mostly on sending mail, or retrieving it using pop3 or imap... [EDIT] What I'm trying to do is forward the messages to an IRC-channel, so obviously when the

Is possible having two COM STA instances of the same component?

六眼飞鱼酱① 提交于 2019-12-08 03:14:25
I had a problem discovered on another thread here , I need to access a COM component that is STA. I'll run it on a dual-core computer, a process using this component only reaches 50% of CPU. Unfortunately, the owners said they can't change the component to MTA, because the component is a hybrid system compiled at Matlab, which core is C. So I tried to load two instances of the COM class on the same process, different threads accessing it, but I couldn't, only the last COM instance becomes usable. Do you know anything that could solve this problem? I am considering running two processes of my

What are the limitations of a STA thread in compare to MTA threads?

℡╲_俬逩灬. 提交于 2019-12-03 11:24:13
问题 If we make a thread STA like this: Thread.SetApartmentState(STA); then it cannot run code marked with [MTAThread] attribute. We have seen [STAThread] in windows and console applications but I have never seen code with [MTAThread] attribute and don't know which .NET libraries use this attribute. My question is what are the limitations of a thread with apartment state set to STA, in compare to threads with MTA apartment state (natural .NET threads) ? 回答1: then it cannot run code marked with

What exactly does an MTA do? [closed]

旧巷老猫 提交于 2019-12-03 07:11:59
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . This question got me thinking, and I now realize that I don't know anything about the internals of MTAs. What exactly does an MTA do? Everything after the SMTP protocol seems like dark magic to me. Let's say that I wanted to code a minimalistic MTA (or MDA) just for sending emails