阅读:1555回复:5
vb如何创建多线程
采用一下方法:
Private Declare Function CreateThread Lib "kernel32" (ByVal lpThreadAttrib utes As Long, ByVal dwStackSize As Long, ByVal lpStartAddress As Long, lpParam eter As Any, ByVal dwCreationFlags As Long, lpThreadId As Long) As Long hRCRThread = CreateThread(Null, ByVal 0&, AddressOf RComReadThread, ByVal 0&, ByVal 0&, 0) Function RComReadThread(ByRef Param As Long) As Long |
|
沙发#
发布于:2004-04-09 13:26
BBS 水木清华站 - Visual Basic编程 - 阅读文章
VisualBasic 版 [上一篇] [下一篇] [同主题上篇] [同主题下篇] 发信人: passivesonar (passivesonar), 信区: VisualBasic 标 题: vb中如何创建多线程 发信站: BBS 水木清华站 (Fri Apr 9 13:22:24 2004) 采用一下方法: Private Declare Function CreateThread Lib "kernel32" (ByVal lpThreadAttrib utes As Long, ByVal dwStackSize As Long, ByVal lpStartAddress As Long, lpParam eter As Any, ByVal dwCreationFlags As Long, lpThreadId As Long) As Long hRCRThread = CreateThread(Null, ByVal 0&, AddressOf RComReadThread, ByVal 0&, ByVal 0&, 0) Function RComReadThread(ByRef Param As Long) As Long 提示:操作符addressof 使用无效,是为什么,谢了先 |
|
板凳#
发布于:2004-04-12 09:55
没想到这里居然还有人问VB的问题!
我从前做过一年多的VB,我的感觉是vb基本上不支持线程,我的方式是:用DoEvents来代替!如果是需要用线程来执行的步骤是循环的话,用DoEvents的效果还是不错的,在循环内部加上这个语句就可以了。如果是与设备打交道的话,效果要差一些。 |
|
|
地板#
发布于:2004-04-13 16:38
vb下可以用多线程,但是很麻烦,可以用doevents来实现基本的需要的功能,赫赫!
|
|
地下室#
发布于:2004-04-14 12:28
用VC就完了么//
|
|
|
5楼#
发布于:2004-10-13 17:22
Function RComReadThread(ByRef Param As Long) As Long
改为 public Function RComReadThread(ByRef Param As Long) As Long 然后把这个函数放入模块里面,这样Addressoff才不会出错 |
|