Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Not Responding" in window title when running in new process

I have a long running method that must run on UI thread. (Devex - gridView.CopyToClipboard())

I do not need the UI to be responsive while copying and I added a splash screen so the user isn't bored out of his mind.

When I run this program all is well.

Trouble starts when I run a different program which in turn starts a new process and runs the program on it. After a few seconds of copying the title reads (Not Responding) and the mouse cursor shows busy, it of course clears up within a few seconds but I'd like to get rid of it since it gives the user the misconstrued feeling that the program is faulty.

Is there any way to set the "Time out" of a process I create?

EDIT:

The main program calls the following code:

fillsProcess = new Process();
fillsProcess.StartInfo.FileName = Application.ExecutablePath;
fillsProcess.Start();

In the fillsProcess, when a certain button is clicked the following code is called:

gridViewToCopy.CopyToClipboard();

This line of code takes a while to process and after a few seconds the window of the fillsProcess looks unresponsive since this method runs on the UI thread..

EDIT The 2nd:

Apparently (and really quite understandably)

gridViewToCopy.CopyToClipboard();

Is not the only method causing this problem. Many Devex methods have to run on UI thread (e.g. Sorting of data, Filtering of data)

So thanks to anyone who offered specific solution (that either worked or didn't) but my original question pops right back up again:

Is there any way to change the time-out time or somehow control the whole "Not Responding" fiasco?

like image 249
E.T. Avatar asked Feb 26 '13 17:02

E.T.


1 Answers

You can use DisableProcessWindowsGhosting win32 function:

[DllImport("user32.dll")]
public static extern void DisableProcessWindowsGhosting();

This actually doesn't prevent the window from freezing, but prevents the "Not Respongind" text in the title.

like image 61
Mohammad Dehghan Avatar answered Sep 27 '22 21:09

Mohammad Dehghan