请问在vb6.0中能不能实现多线程

newgina 2003-07-04 09:56:10
请问在vb6.0中能不能实现多线程

如果能要用什么控件或函数,还是的调用api呢
谢谢   
...全文
67 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
newgina 2003-07-04
  • 打赏
  • 举报
回复
多谢lihonggeng0这两天对我的帮助
wzhjs 2003-07-04
  • 打赏
  • 举报
回复
没有啊,用Win32 API:CreateThread很e的,而且慢稳定的
lihonggen0 2003-07-04
  • 打赏
  • 举报
回复
在Vb下实现多线程



新建一Module
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
Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

Sub main()
Load Form1
Form1.Show
End Sub
Public Sub c1()
.......
End Sub

Public Sub c2()
......
End Sub

新建一窗体

Private hthread1 As Long
Private hthread2 As Long
Private ithread1 As Long
Private ithread2 As Long

Private Sub Command1_Click()

ithread1 = CreateThread(ByVal 0&, ByVal 0&, AddressOf c1, ByVal 0&, ByVal 0&, hthread1) --创建线程一
ithread2 = CreateThread(ByVal 0&, ByVal 0&, AddressOf c1, ByVal 0&, ByVal 0&, hthread1) --创建线程二

CloseHandle ithread1 --关闭线程一
CloseHandle ithread2 --关闭线程二

End Sub

Private Sub Form_Load()

End Sub


lihonggen0 2003-07-04
  • 打赏
  • 举报
回复
http://www.bssoft.com.cn/vbThread.rar
lihonggen0 2003-07-04
  • 打赏
  • 举报
回复
调用api可以实现,但是不稳定,有很多麻烦,建议用VC或.net做


http://www.csdn.net/develop/Read_Article.asp?Id=18660
kmcyz 2003-07-04
  • 打赏
  • 举报
回复
能,用API,但不是很稳定。

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧