Lak,
The problem with this involves the threading model that is inherent to
VB.
While you could start an asynchronous operation in VB (calling a .NET
component) and then provide some sort of callback, the problem is that you
have to call back on the thread that the component was created on. This
presents a problem.
The easiest way to do this would be to create an interface that
represents the callback which your VB component will implement. You then
pass this interface in a call to start the asynchronous operation. You can
then pass this interface to your thread, which will call back on the
interface.
The only problem here is that you have to marshal the interface
correctly, using the global interface table. You can do this using the
IGlobalInterfaceTable interface (through COM interop), or the
CoMarshalInterThreadInterfaceInStream function.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Lak" <La*@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
I have a C# method that will run for a while. While it runs, I don't want
to
lock up the GUI. I need to retrieve some progress information from the C#
DLL. Therefore, I want to run the first method asynchronous so that I can
use
another method to retrieve progress info. Does this help? Thanks for your
reply.
"Willy Denoyette [MVP]" wrote:
Please define what you mean with 'asynchronously', your only option to
call
into C# is through COM interop and such method calls are always
synchronous.
What exactly are you trying to achieve?
Willy.
"Lak" <La*@discussions.microsoft.com> wrote in message
news:0D**********************************@microsof t.com...
| VB6.0
|
| "Jon Skeet [C# MVP]" wrote:
|
| > Lak wrote:
| > > I am trying to call a C# method (in a DLL) asynchronously from VB.
I
don't
| > > know how to do this. Any suggestion is appreciated. Thanks.
| >
| > Do you mean VB6 or VB.NET?
| >
| > Jon
| >
| >