473,324 Members | 2,417 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,324 software developers and data experts.

Yield control to windows for screen update

Hello,

While in extensive math calculation in MFC application, i used to yield
control to window by calling this code:

void YieldControl( void )
{
MSG msg ;
if( ::PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
{
::TranslateMessage( &msg ) ;
::DispatchMessage( &msg ) ;
}
}

How can I do similar thing in .Net application?

Thank you,
Eitan Barazani
Jun 13 '07 #1
6 3417
Eitan,

Yes, you could. You can call the static DoEvents method on the
Application class in order to process messages that are in the queue.

However, I STRONGLY advise against it. Rather, you should be performing
these calculations on another thread and then calling the Invoke method on a
control, passing a delegate to be executed on the UI thread when you need to
perform an update.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Eitan" <Ei***@discussions.microsoft.comwrote in message
news:45**********************************@microsof t.com...
Hello,

While in extensive math calculation in MFC application, i used to yield
control to window by calling this code:

void YieldControl( void )
{
MSG msg ;
if( ::PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
{
::TranslateMessage( &msg ) ;
::DispatchMessage( &msg ) ;
}
}

How can I do similar thing in .Net application?

Thank you,
Eitan Barazani


Jun 13 '07 #2
"Eitan" <Ei***@discussions.microsoft.comwrote in message
news:45**********************************@microsof t.com...
How can I do similar thing in .Net application?
See Nicholas' reply - threading is absolutely the way to do this.

A very popular use of this is updating the panel(s) of a StatusStrip control
while the second thread doing the time-consuming work is running.
http://www.google.co.uk/search?sourc...usStrip+thread
--
http://www.markrae.net

Jun 13 '07 #3
Thanks.

Any article that I should look into here?

Eitan

"Nicholas Paldino [.NET/C# MVP]" wrote:
Eitan,

Yes, you could. You can call the static DoEvents method on the
Application class in order to process messages that are in the queue.

However, I STRONGLY advise against it. Rather, you should be performing
these calculations on another thread and then calling the Invoke method on a
control, passing a delegate to be executed on the UI thread when you need to
perform an update.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Eitan" <Ei***@discussions.microsoft.comwrote in message
news:45**********************************@microsof t.com...
Hello,

While in extensive math calculation in MFC application, i used to yield
control to window by calling this code:

void YieldControl( void )
{
MSG msg ;
if( ::PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
{
::TranslateMessage( &msg ) ;
::DispatchMessage( &msg ) ;
}
}

How can I do similar thing in .Net application?

Thank you,
Eitan Barazani


Jun 13 '07 #4
Eitan,

This is a pretty common question on the boards. You could search
google, or google groups, with the terms "threading windows forms invoke
delegate" and find a number of posts relating to the subject.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Eitan" <Ei***@discussions.microsoft.comwrote in message
news:9B**********************************@microsof t.com...
Thanks.

Any article that I should look into here?

Eitan

"Nicholas Paldino [.NET/C# MVP]" wrote:
>Eitan,

Yes, you could. You can call the static DoEvents method on the
Application class in order to process messages that are in the queue.

However, I STRONGLY advise against it. Rather, you should be
performing
these calculations on another thread and then calling the Invoke method
on a
control, passing a delegate to be executed on the UI thread when you need
to
perform an update.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Eitan" <Ei***@discussions.microsoft.comwrote in message
news:45**********************************@microso ft.com...
Hello,

While in extensive math calculation in MFC application, i used to yield
control to window by calling this code:

void YieldControl( void )
{
MSG msg ;
if( ::PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
{
::TranslateMessage( &msg ) ;
::DispatchMessage( &msg ) ;
}
}

How can I do similar thing in .Net application?

Thank you,
Eitan Barazani




Jun 13 '07 #5
If you are not familiar with topic, start from this
http://msdn.microsoft.com/msdnmag/is...ultithreading/

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:%2****************@TK2MSFTNGP02.phx.gbl...
Eitan,

This is a pretty common question on the boards. You could search
google, or google groups, with the terms "threading windows forms invoke
delegate" and find a number of posts relating to the subject.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Eitan" <Ei***@discussions.microsoft.comwrote in message
news:9B**********************************@microsof t.com...
>Thanks.

Any article that I should look into here?

Eitan

"Nicholas Paldino [.NET/C# MVP]" wrote:
>>Eitan,

Yes, you could. You can call the static DoEvents method on the
Application class in order to process messages that are in the queue.

However, I STRONGLY advise against it. Rather, you should be
performing
these calculations on another thread and then calling the Invoke method
on a
control, passing a delegate to be executed on the UI thread when you
need to
perform an update.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Eitan" <Ei***@discussions.microsoft.comwrote in message
news:45**********************************@micros oft.com...
Hello,

While in extensive math calculation in MFC application, i used to
yield
control to window by calling this code:

void YieldControl( void )
{
MSG msg ;
if( ::PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
{
::TranslateMessage( &msg ) ;
::DispatchMessage( &msg ) ;
}
}

How can I do similar thing in .Net application?

Thank you,
Eitan Barazani





Jun 13 '07 #6
Alex, Thanks!
Eitan

"AlexS" wrote:
If you are not familiar with topic, start from this
http://msdn.microsoft.com/msdnmag/is...ultithreading/

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:%2****************@TK2MSFTNGP02.phx.gbl...
Eitan,

This is a pretty common question on the boards. You could search
google, or google groups, with the terms "threading windows forms invoke
delegate" and find a number of posts relating to the subject.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Eitan" <Ei***@discussions.microsoft.comwrote in message
news:9B**********************************@microsof t.com...
Thanks.

Any article that I should look into here?

Eitan

"Nicholas Paldino [.NET/C# MVP]" wrote:

Eitan,

Yes, you could. You can call the static DoEvents method on the
Application class in order to process messages that are in the queue.

However, I STRONGLY advise against it. Rather, you should be
performing
these calculations on another thread and then calling the Invoke method
on a
control, passing a delegate to be executed on the UI thread when you
need to
perform an update.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Eitan" <Ei***@discussions.microsoft.comwrote in message
news:45**********************************@microso ft.com...
Hello,

While in extensive math calculation in MFC application, i used to
yield
control to window by calling this code:

void YieldControl( void )
{
MSG msg ;
if( ::PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
{
::TranslateMessage( &msg ) ;
::DispatchMessage( &msg ) ;
}
}

How can I do similar thing in .Net application?

Thank you,
Eitan Barazani




Jun 13 '07 #7

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

Similar topics

2
by: vivek | last post by:
I am trying to install visual studio .NE The system prompts for windows componet update. When i click that it asks for windows update CD, which eventually I dont have. The readme.txt doc displays...
1
by: Ryan | last post by:
Hello Today when installing .NET on Windows XP Pro with all critical updates, etc. installed, I noticed I never had to use the Windows Component Update CD. I successfully got through the...
1
by: Eric Kinkead | last post by:
(doh... that was me) Here is the problem.... I try to install my VisualBasic.net Standard Version 2002 But then it just sits there and asks for "Windows Component Update Disk for Visual...
9
by: lauren quantrell | last post by:
Is there a way to determine the size of the user's screen minus the Windows task bar? I am trying to maximize an Access popup form that is also resizeable and it is causing me problems since it...
4
by: Steven K | last post by:
Hello, I am trying to install vb.net and I am getting the following: Windows Component Update Setup has detected that some of the windows components that are installed on your computer do not...
1
by: Udi | last post by:
Hi, I have a listbox and a textbox that are built and shown dynamically. My problem is that their positions and sizes may cause them to be displayed out of the their parent form bounds, and in a...
7
by: devecibasi | last post by:
Hi all, I have a macro that executes ~200 queries which modify the data, create some tables etc. The macro runs when the user clicks a button on a form. I would like the queries to be invisible...
0
by: =?Utf-8?B?S29uc3RhbnRpbg==?= | last post by:
I have a need to have a repeater inside update panel control which should update dynamically when "Update" button is clicked. I have repeater inside update panel control which takes custom...
6
by: davidson1 | last post by:
If I am using UNIX,suppose if I need to see the Windows Screen,Is it is Possible,Which Command can be used for that.
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.