vb调用createthread创建线程失败.txt

来自「VB技巧问答10000例 VB技巧问答10000例」· 文本 代码 · 共 23 行

TXT
23
字号
Simply say, AddressOf doesn't behave properly in VB6. It is really lucky you didn't get a GPF when you trying to use multi-thread with CreateThread function. In other word CreateThread DOESN'T work. 
    You may try to use Apartment thread in vb6 that is a good or say stable way to use multi-thread in vb. 
<END>    
CreateThread API 定 义 为 : 
     Public Declare Function CreateThread Lib "kernel32" _ 
     (lpThreadAttributes As Long, ByVal dwStackSize As Long, _ 
     byval lpStartAddress As Long, lpParameter As Any, ByVal _ 
     dwCreationFlags As Long, lpThreadId As Long) As Long 
     Public vbbl As Boolean 
    就 可 以 了 ! 
<END>    
函 数 声 明 为 : 
    Declare Function CreateThread Lib "kernel32" (ByVal lpSecurityAttributes As Long, _ 
     ByVal dwStackSize As Long, _ 
     ByVal lpStartAddress As Long, _ 
     ByVal lpParameter As Long, _ 
     ByVal dwCreationFlags As Long, _ 
     lpThreadId As Long) As Long 
    调 用 : 
    hnd = CreateThread(0, 2000, AddressOf线 程 体 名 ( 函 数 名 ) ,参 数 , 0, threadid) 
    即 可 。 
<END>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?