473,534 Members | 3,322 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What is the difference

between STAThread and MTAThread?
Nov 16 '05 #1
6 1444
STAThread Single Threaded Apartment Thread
MTAThread Multi Threaded Apartment Thread

These refer to the COM threading model and have no effect unless COM interop
is used.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"DAMAR" <DA***@discussions.microsoft.com> wrote in message
news:C4**********************************@microsof t.com...
between STAThread and MTAThread?

Nov 16 '05 #2
Bob Powell [MVP] wrote:
STAThread Single Threaded Apartment Thread
MTAThread Multi Threaded Apartment Thread

These refer to the COM threading model and have no effect unless COM interop
is used.


Hmmm...
Frankly writing, i ecounter that [STAThread] attribute makes
that windows application (without COMs) behave very strange, e.g.:
- application icons (taskbar and window) haven't transparency
- message boxes occures without text
- text disapear from controls.

I'm not sure what's going on, but i remove [STAThread] wherever
i can and then these problems disapear.

Regards
Marcin
Nov 16 '05 #3
You should't remove the attribute for Windows forms based programs (note
that for VB.NET it's the default), simply because it's not because you don't
use COM that Windows Forms doesn't use it under the covers (think of OLE
drag/drop and ActiveX controls in the toolbox).
Your problem is not directly related to the STAThread attribute anyway.

Willy.
"Marcin Grzębski" <mg*******@taxussi.no.com.spam.pl> wrote in message
news:ct**********@atlantis.news.tpi.pl...
Bob Powell [MVP] wrote:
STAThread Single Threaded Apartment Thread
MTAThread Multi Threaded Apartment Thread

These refer to the COM threading model and have no effect unless COM
interop is used.


Hmmm...
Frankly writing, i ecounter that [STAThread] attribute makes
that windows application (without COMs) behave very strange, e.g.:
- application icons (taskbar and window) haven't transparency
- message boxes occures without text
- text disapear from controls.

I'm not sure what's going on, but i remove [STAThread] wherever
i can and then these problems disapear.

Regards
Marcin

Nov 16 '05 #4
Marcin,

You are sure that it is not this known problem?
https://knowledgemap.nai.com/phpclie..._KnowledgeBase

Cor
Nov 16 '05 #5
Hi,

THANKS!
:-)
You're hit the 10!

McAfee VirusScan - source of all evil ;-)
[i hope in .NET only]

Cheers!
Marcin
Marcin,

You are sure that it is not this known problem?
https://knowledgemap.nai.com/phpclie..._KnowledgeBase

Cor

Nov 16 '05 #6
Hi Willy,

Thank you too!
Antivirus makes my trouble. But i'm so curios about
[STAThread] relation.

Cheers :-)
Marcin
You should't remove the attribute for Windows forms based programs (note
that for VB.NET it's the default), simply because it's not because you don't
use COM that Windows Forms doesn't use it under the covers (think of OLE
drag/drop and ActiveX controls in the toolbox).
Your problem is not directly related to the STAThread attribute anyway.

Willy.
"Marcin Grzębski" <mg*******@taxussi.no.com.spam.pl> wrote in message
news:ct**********@atlantis.news.tpi.pl...
Bob Powell [MVP] wrote:
STAThread Single Threaded Apartment Thread
MTAThread Multi Threaded Apartment Thread

These refer to the COM threading model and have no effect unless COM
interop is used.


Hmmm...
Frankly writing, i ecounter that [STAThread] attribute makes
that windows application (without COMs) behave very strange, e.g.:
- application icons (taskbar and window) haven't transparency
- message boxes occures without text
- text disapear from controls.

I'm not sure what's going on, but i remove [STAThread] wherever
i can and then these problems disapear.

Regards
Marcin


Nov 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

125
14552
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from software giant such as Microsoft SQL Server, Oracle, and Sybase? Is PostgreSQL reliable enough to be used for high-end commercial application? Thanks
1
8260
by: mike | last post by:
best regards: What is the difference between DOM Level 1 and DOM Level 2. Thank you. May god be with you.
5
20587
by: radnus2004 | last post by:
Hi all, I am not clear what is the difference between signed and unsigned in C. Many say, unsigned means only +ve values and 0. Can I use unsigned int i = -3? What happens internally ? What conversion happens? Also on 32 and 64bit machines what happens? Can anybody explain?
10
15617
by: tinesan | last post by:
Hello fellow C programmers, I'm just learning to program with C, and I'm wondering what the difference between signed and unsigned char is. To me there seems to be no difference, and the standard doesn't even care what a normal char is (because signed and unsigned have equal behavior). For example if someone does this: unsigned char a...
13
5007
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
12
17361
by: Nathan Sokalski | last post by:
What is the difference between the Page_Init and Page_Load events? When I was debugging my code, they both seemed to get triggered on every postback. I am assuming that there is some difference, and I would like to know what it is so that I can take advantage of it in my code. Thanks. -- Nathan Sokalski njsokalski@hotmail.com...
3
3003
by: Anoj Kumar | last post by:
Hi All , can anyone tell me what is the difference between the following declaration and how it affects application performance. 1. Dim cn As ADODB.Connection Set cn = New ADODB.Connection
6
11237
by: Mark Kamoski | last post by:
Hi Everyone-- Please help. What is the difference between a Field and a Property? Here is the context. In the VS.NET 2002 documentation, in the "String Members" section, we have the following...
5
5836
by: kai | last post by:
Hi, In ASP.NET , what is the difference between OnClick and Click events for a button? Because we have button click event, it can trigger events, why we still need OnClick? Please help. Thanks kai
49
2382
by: Zach | last post by:
After having taken a looong break from VB (last used 6.0), I started getting back into programming again, this time with VS 2005. I began reading up on VB.NET from various sources (books, internet, etc.) and found out about the CLR and how all of the .NET languages access it, the major difference being the syntax and structure of the...
0
7359
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7529
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
5821
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5210
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4840
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3341
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3334
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
913
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
570
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.