Re: Creating Thread under VB
- From: "MikeD" <nobody@xxxxxxxxxxx>
- Date: Tue, 10 May 2005 06:26:07 -0400
"akuma" <akuma@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C8D0F5A7-DF3D-48EE-A85B-DB02FC708DB8@xxxxxxxxxxxxxxxx
>I have problems of creating thread under VB. VB crush when the CreateThread
> fucntion called. After correct the wrong declaration copied from the API
> viewer from:
> Private Declare Function CreateThread Lib "kernel32" (lpThreadAttributes
> As
> Any, ByVal dwStackSize As Long, lpStartAddress As Long, lpParameter As
> Any,
> ByVal dwCreationFlags As Long, lpThreadId As Long) As Long
> to:
> Private Declare Function CreateThread Lib "kernel32" (lpThreadAttributes
> As
> Any, ByVal dwStackSize As Long, ByVal lpStartAddress As Long, lpParameter
> As
> Any, ByVal dwCreationFlags As Long, lpThreadId As Long) As Long
>
> A thread was created under IDE. However, the CreateThread function can't
> run
> more than once and it is ignored inside the For loop. Sometimes, the
> thread
> was created once and sometimes it crush under IDE. After compile the code
> to
> the EXE file it crushes all the time.
>
VB6 is not thread-safe. Creating threads as you're doing is going to be
unpredictable at best. This is documented in the KB:
PRB: Access Violation in VB Run-Time Using AddressOf
http://support.microsoft.com/default.aspx?scid=kb;en-us;198607
--
Mike
Microsoft MVP Visual Basic
.
- References:
- Creating Thread under VB
- From: akuma
- Creating Thread under VB
- Prev by Date: Creating Thread under VB
- Next by Date: Re: Microsoft Layer for Unicode on Windows 95/98/Me systems
- Previous by thread: Creating Thread under VB
- Next by thread: Re: Creating Thread under VB
- Index(es):
Relevant Pages
|