Home All Groups Group Topic Archive Search About

Wait while processing dialog boxes (threading?)

Author
19 Apr 2006 5:05 PM
Dustin Davis
I'm doing image conversion in my application and it seems to take some
time on some tasks. I'd like to show a "Converting..." type message in a
dialog box or splash screen of sorts.

The problem is that when I call ShowDialog() the app waits for the
dialog to close before it continues to process. Is there a way to show
the dialog while doing the conversions and close it when it's done
without using threads? Truth is, I don't want to deal with threading if
possible :)

Author
19 Apr 2006 7:50 PM
Chris
Dustin Davis wrote:
> I'm doing image conversion in my application and it seems to take some
> time on some tasks. I'd like to show a "Converting..." type message in a
> dialog box or splash screen of sorts.
>
> The problem is that when I call ShowDialog() the app waits for the
> dialog to close before it continues to process. Is there a way to show
> the dialog while doing the conversions and close it when it's done
> without using threads? Truth is, I don't want to deal with threading if
> possible :)

You can use the Application.DoEvents() routine to let the OS free up the
  time to do the redrawing of the window.  But this will slow down your
processing.  Really should do it in threads.

Chris
Author
19 Apr 2006 8:57 PM
Dustin Davis
Okay, so if I have the following code function:

Function SaveFile(ByVal FileName As String) As Boolean
     ' Save the file as FileName
     Return True
End Function

Can I call this function with a Thread, or do I need to rewrite it somehow?

Chris wrote:
Show quoteHide quote
> Dustin Davis wrote:
>> I'm doing image conversion in my application and it seems to take some
>> time on some tasks. I'd like to show a "Converting..." type message in
>> a dialog box or splash screen of sorts.
>>
>> The problem is that when I call ShowDialog() the app waits for the
>> dialog to close before it continues to process. Is there a way to show
>> the dialog while doing the conversions and close it when it's done
>> without using threads? Truth is, I don't want to deal with threading
>> if possible :)
>
> You can use the Application.DoEvents() routine to let the OS free up the
>  time to do the redrawing of the window.  But this will slow down your
> processing.  Really should do it in threads.
>
> Chris
Author
1 May 2006 10:53 PM
Dustin Davis
Anyone know how I can return a value from a thread?

Dustin Davis wrote:
Show quoteHide quote
> Okay, so if I have the following code function:
>
> Function SaveFile(ByVal FileName As String) As Boolean
>     ' Save the file as FileName
>     Return True
> End Function
>
> Can I call this function with a Thread, or do I need to rewrite it somehow?
>
> Chris wrote:
>> Dustin Davis wrote:
>>> I'm doing image conversion in my application and it seems to take
>>> some time on some tasks. I'd like to show a "Converting..." type
>>> message in a dialog box or splash screen of sorts.
>>>
>>> The problem is that when I call ShowDialog() the app waits for the
>>> dialog to close before it continues to process. Is there a way to
>>> show the dialog while doing the conversions and close it when it's
>>> done without using threads? Truth is, I don't want to deal with
>>> threading if possible :)
>>
>> You can use the Application.DoEvents() routine to let the OS free up
>> the  time to do the redrawing of the window.  But this will slow down
>> your processing.  Really should do it in threads.
>>
>> Chris