Application in focus

  • Thread starter Thread starter Alan T
  • Start date Start date
A

Alan T

How do I make my application back to focus during it is processing I switch
to other application and back ?

During my application processing, I open another application, eg. notepad.
Then I select my application, my application screen is in white.
 
This isn't a focus issue, this is a matter of you doing all the
processing on the main UI thread.

Perform your processing on another thread, and leave the UI thread to
process messages, and you should have no problem switching back.

Hope this helps.
 
What I want to do is I want to let the process finish first before the user
can select the main form.
During the process the cursor is in "wait" type.
I just want to make the main form appear normal except cannot select the
controls on the form.If the main form appears in white, the user may think
the system is hang.

Nicholas Paldino said:
This isn't a focus issue, this is a matter of you doing all the
processing on the main UI thread.

Perform your processing on another thread, and leave the UI thread to
process messages, and you should have no problem switching back.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Alan T said:
How do I make my application back to focus during it is processing I
switch to other application and back ?

During my application processing, I open another application, eg.
notepad. Then I select my application, my application screen is in white.
 
Hi,

This is what I did to solve my problem:

Main Form:
private void tsMnRebuild_Click(object sender, EventArgs e)

{

Thread KeywordThread = new Thread(new ThreadStart(this.ExecuteRebuild));

KeywordThread.Start();

}

private void ExecuteRebuild()

{

.........

.........

}



I have a conern:

Is there any possibility to make the main form crash if something happen to
the thread ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top