looking at all the references I got, I understand now that program might crash
if we try to call a object from other thread without marshalling, it might
crash. however, consider the following :

I got a normal vb program, in the form load, I create a new thread, something
look like this,

handle = CreateThread(ByVal 0&, ByVal 0&, AddressOf Thread, 0&, ByVal 0&,
id)


in the thread function in a public module file, which should look like this,

Option Explicit

Declare Function InitPacketDriverNT Lib "vbLibDll.Dll" (Var As Long) As Long
Declare Function ReadPacketNT Lib "vbLibDll.Dll" (ByVal Sync As Long, ByRef
Bytes As Long) As Long
Declare Function CreateThread Lib "kernel32" (ByVal lpThreadAttributes As
Any, ByVal dwStackSize As Long, ByVal lpStartAddress As Long, lpParameter
As Any, ByVal dwCreationFlags As Long, lpThreadID As Long) As Long


Global ThreadControl As Long

Public Function Thread(Param As Long) As Long
Dim data As Long

InitPacketDriverNT 0

Do While ThreadControl = 0

ReadPacketNT 1, data

Loop

End Function

as we can see from this, the thread function never call any object, but a
normal win32 DLL function (compiled in VC++), but it failed !!! it shouldn't
be as the thread function never call other object from the main thread.

what's can be wrong ?? it's because the new thread can't call the function
? but the dll should be loaded within the process memory and accessible by
every thread.

"Matthew Curland" <mattcur@microsoft.com> wrote:
>Or you can look at my articles in June 99 VBPJ, or the threading material

in
>my book (http://www.PowerVB.com). This will tell you how to do it safely
>instead of explaining why VB6 can't handle it. Dan gives a good presentation
>on threading models and COM marshalling, but the conclusions (summarized

as
>'The only safe way to create background threads in a Dll in VB6 is to buy
>SpyWorks 6.2") are highly questionable, especially considering that the

6.2
>product shipped well after a robust pure VB6 solution to the problem had
>been published. -Matt
>
>"Sachin" <sachin.nigam@orbit-e.com> wrote in message
>news:3b2edc2f@news.devx.com...
>> check out Dan Appleman's article *A Thread to Visual Basic* on Desaware's
>> website
>> Sachin

>
>
>