Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Programming
You last visited: Today at 06:06

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Windows Forms and Threads.

Discussion on Windows Forms and Threads. within the CO2 Programming forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: May 2011
Posts: 1,769
Received Thanks: 756
Windows Forms and Threads.

I know it's not a conquer related question, but since a lot of people here is C# programmers I just thought I would ask here.

Why is it exactly you cannot enter Windows Form Controls from another thread?

Not asking how to do it, but why it's not allowed.
BaussHacker is offline  
Old 09/20/2011, 16:05   #2
 
elite*gold: 20
Join Date: Aug 2007
Posts: 1,749
Received Thanks: 2,199
No idea, I think it's to prevent data corruption and/or thread locking

Edit:
Quote:
Originally Posted by http://msdn.microsoft.com/en-us/library/ms171728%28v=vs.80%29.aspx
Access to Windows Forms controls is not inherently thread safe. If you have two or more threads manipulating the state of a control, it is possible to force the control into an inconsistent state. Other thread-related bugs are possible as well, including race conditions and deadlocks. It is important to ensure that access to your controls is done in a thread-safe way.
So, it's not about data corruption anyways. I think it's pretty stupid though, I mean adding an item to a listbox or changing the title of a label in a seperate thread shouldn't be a problem if you know what you're doing - I'm pretty sure those things just use the PostMessage (or SendMessage) function anyways which is completely thread-safe. Microsoft is ****.
IAmHawtness is offline  
Thanks
3 Users
Old 09/20/2011, 21:26   #3
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
To ever so slightly expand on that... You can just turn off checking for cross thread calls... Or use super simple thread safe code to completely bypass the issue (and I guess technically make it less errorprone)
pro4never is offline  
Thanks
1 User
Old 09/20/2011, 22:22   #4
 
elite*gold: 20
Join Date: Aug 2007
Posts: 1,749
Received Thanks: 2,199
Quote:
Originally Posted by pro4never View Post
To ever so slightly expand on that... You can just turn off checking for cross thread calls... Or use super simple thread safe code to completely bypass the issue (and I guess technically make it less errorprone)
I'd rather just use Control.(Begin)Invoke methods to be honest, it's probably the best/safest way. I'm pretty sure the thread starter already knows about these methods though, since he said he wasn't asking how to do it
IAmHawtness is offline  
Thanks
1 User
Old 09/21/2011, 03:45   #5
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
Quote:
Originally Posted by IAmHawtness View Post
I'd rather just use Control.(Begin)Invoke methods to be honest, it's probably the best/safest way. I'm pretty sure the thread starter already knows about these methods though, since he said he wasn't asking how to do it
Yah I started to actually look into and use thread safe ways of accessing controls but just figured I'd mention as always that you can just turn the **** thing off.
pro4never is offline  
Thanks
1 User
Old 09/21/2011, 07:31   #6
 
elite*gold: 0
Join Date: May 2011
Posts: 1,769
Received Thanks: 756
Thanks for the answers both ^^
BaussHacker is offline  
Old 09/21/2011, 14:25   #7
 
InfamousNoone's Avatar
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,885


Set to false, if you really want to disable it.
InfamousNoone is offline  
Thanks
1 User
Old 09/21/2011, 14:54   #8
 
elite*gold: 0
Join Date: May 2011
Posts: 1,769
Received Thanks: 756
Quote:
Originally Posted by InfamousNoone View Post


Set to false, if you really want to disable it.
LOL! Well just wanted to know why it's not allowed, but didn't know that existed.
BaussHacker is offline  
Reply


Similar Threads Similar Threads
thanatos forms
08/17/2010 - Grand Chase Philippines - 20 Replies
1st formhttp://images2.wikia.nocookie.net/__cb20100528 043435/grandchase/images/7/78/ThanatosForm1.jpg2nd formhttp://images1.wikia.nocookie.net/__cb20100528 043417/grandchase/images/2/21/ThanatosForm2.jpg3rd and final formhttp://images1.wikia.nocookie.net/__cb20100528 043254/grandchase/images/2/29/ThanatosForm3.jpg thanatos the god of damnation press thanks you like my post
C# forms... silly question, lol
12/30/2008 - CO2 Programming - 4 Replies
I know that this is nooby, but I can`t find it anywhere. My C# form has a menustrip, a statustrip and a webbrowser in it. How can I make it so when I stretch the form, everything moves, not just the size of the form?
epvp revealed in co forms
03/17/2006 - Conquer Online 2 - 30 Replies
Looks like people are going to start findin out about this site alot more maybe co will start cracking down on ppl http://bbs.conqueronline.com/showthread.ph...& ;highlight=EPVP



All times are GMT +1. The time now is 06:11.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.