473,414 Members | 1,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

A question about "Safe, Simple Multithreading in Windows Forms, Part 1" on MSDN

These days,I have read the artile "Safe, Simple Multithreading in Windows
Forms, Part 1" on MSDN,and I also runed the example of it.
http://msdn.microsoft.com/library/de...ms06112002.asp
The question is In function void ShowProgress(string pi, int totalDigits,
int digitsSoFar);
if I use Invoke(showProgress, new object[] { pi, totalDigits,
digitsSoFar});the UI performs better(it responses to my minimize&restore
faster),and if I use BeginInvoke(showProgress, new object[] { pi,
totalDigits, digitsSoFar});,then the UI seems performs slower.
why Invoke is better than BeginInvoke?(As generally thinking,BeginInvoke
should be better than Invoke,because it works asynchronously).

thanks!
Nov 15 '05 #1
1 1929
Jeff,

Invoke(...) runs the passed delegate on the UI thread synchronously (that
is, the calling thread will block until the Invoke() call returns).

BeginInvoke(...) returns immediately and schedules the delegate to be run on
the UI thread.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Jeff Yang" <de*****@hotmail.com> wrote in message
news:eA**************@TK2MSFTNGP11.phx.gbl...
These days,I have read the artile "Safe, Simple Multithreading in Windows
Forms, Part 1" on MSDN,and I also runed the example of it.
http://msdn.microsoft.com/library/de...ms06112002.asp The question is In function void ShowProgress(string pi, int totalDigits,
int digitsSoFar);
if I use Invoke(showProgress, new object[] { pi, totalDigits,
digitsSoFar});the UI performs better(it responses to my minimize&restore
faster),and if I use BeginInvoke(showProgress, new object[] { pi,
totalDigits, digitsSoFar});,then the UI seems performs slower.
why Invoke is better than BeginInvoke?(As generally thinking,BeginInvoke
should be better than Invoke,because it works asynchronously).

thanks!


Nov 15 '05 #2

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

Similar topics

4
by: lwickland | last post by:
Non-visual C# objects on a webpage are not marked as "safe for scripting" I'm developing .NET components in C# which are used as ActiveX-style controls on web pages that are displayed inside a...
2
by: Twitch | last post by:
Is there an event or "something" that happens where I can Log a message (or whatever) when a logon attempt fails when using "Windows Authentication". If not, I could just do my own logon screen,...
4
by: Scott Johnson | last post by:
Hi! Is there a way to "preload" a form using a thread or something else so that my user doesn't have to wait 5 seconds (initializing time) between forms? Some of these forms have tab strips with...
2
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! I have been struggeling with this Windows, Authentication method for a while, and i am beginning to give up. So a couple of questions that you guys probably have the answer on. 1. One...
12
by: bg_ie | last post by:
Hi, Where on the internet can I learn about Multithreading for C using functions like WaitForSingleObject(), CreateThread(), CreateMutex() etc, rather than pthreads. Thanks, Barry.
0
PEB
by: PEB | last post by:
Hi everybody There is a site about Windows http://www.functionx.com/windows/index.htm :)
0
by: godsmustbcrazy | last post by:
Here is my problem. Brand new SQL Server 2005 Installation 1. Create a database "Test" 2. Create a database user "Domain\user" and set user mapping to "Test" with datareader, datawriter...
5
by: Mark Chambers | last post by:
Hi there, Can anyone explain the following (very) simple scenario. 1) I make an exact copy of my "DataSet" and delete one record from a given table (in the copy) 2) I invoke...
1
by: manchin2 | last post by:
Hi, Can anybody please provide the information about "&quot" and its use, if possible please provide an example. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...

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.