Asynchronous Process

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I used asynchronous process with a delegate in vb.net. Sometime the callback couldn't terminate successfully, except when a msgbox was used to interrupt it. Anybody has an ideal

Thank
 
hello, attaching some code would be useful...
are you saying the callback wouldn't fire, or
an exception is thrown in the callback method?
 
Tim

Callback is running correctly, i.e. no exception. But couldn't complete. The process is described as follows

1. Open a message window asynchronously
2. Do some tasks
3. Close the message window by callback. (couldn't

If I added a msgbox into callback process, then step 3 is okay. I think this is relative to thread issue

Li Pan
 
I'm not entirely sure about this, but I believe that callbacks require your
app to have a message loop running (using msgbox automatically creates one
in the background) - try adding one to your app (you will need to create a
thread to run it):

'this will create a message loop - note that the method call to Run never
returns, so we need to call it in a seperate thread
Sub MsgLoop()
Windows.Forms.Application.Run()
End Sub

'Add this code to your initialization code:
Dim th As New Threading.Thread(AddressOf MsgLoop)
th.Start()

Hope that helps.
Alex

--------------------
Thread-Topic: Asynchronous Process
thread-index: AcQNuIZo4gfaWgqeRz+2COPZ1q8Jqw==
X-Tomcat-NG: microsoft.public.dotnet.languages.vb
From: "=?Utf-8?B?TGkgUGFuZw==?=" <[email protected]>
References: <[email protected]>
Subject: Re: Asynchronous Process
Date: Fri, 19 Mar 2004 05:46:05 -0800
Lines: 13
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.languages.vb
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:189663
NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

Tim,

Callback is running correctly, i.e. no exception. But couldn't complete.
The process is described as follows:

1. Open a message window asynchronously.
2. Do some tasks.
3. Close the message window by callback. (couldn't)

If I added a msgbox into callback process, then step 3 is okay. I think
this is relative to thread issue.

Li Pang
 
Back
Top