vb.net的多进程 vbnet 多线程
VB多进程怎么做啊?就是那个啥activex exe的,能详细一点吗?
VB的多线程比较吃力。多个线程最后想出的办法是用多个进程也就是你说的exe代替多个线程。一个form就是一个进程你搞几个from其实就是多进程也就是类似的多线程但是比较麻烦点而已,顺便给个建议VB.NET可以轻松解决多线程。
“专业、务实、高效、创新、把客户的事当成自己的事”是我们每一个人一直以来坚持追求的企业文化。 创新互联是您可以信赖的网站建设服务商、专业的互联网服务提供商! 专注于成都网站设计、做网站、软件开发、设计服务业务。我们始终坚持以客户需求为导向,结合用户体验与视觉传达,提供有针对性的项目解决方案,提供专业性的建议,创新互联建站将不断地超越自我,追逐市场,引领市场!
Vb 多进程技术
调用 2.exe 用 shell 方法就可以了.不用多说.
至于检测 5个 2.exe 是否全都结束的方法,可以在 1.exe 中添加1个TIMER ,设定每隔1秒遍历系统进程表.]
找出系统进程中 2.exe 的个数,若为 0个 则显示"处理完成"
遍历进程需要调用API:
Declare Function CreateToolhelpSnapshot Lib "kernel32" Alias "CreateToolhelp32Snapshot" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Declare Function ProcessFirst Lib "kernel32" Alias "Process32First" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Declare Function ProcessNext Lib "kernel32" Alias "Process32Next" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Const MAX_PATH As Integer = 260
Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szExeFile As String * MAX_PATH
End Type
Const TH32CS_SNAPheaplist = H1
Const TH32CS_SNAPPROCESS = H2
Const TH32CS_SNAPthread = H4
Const TH32CS_SNAPmodule = H8
Public Const TH32CS_SNAPall = TH32CS_SNAPPROCESS + TH32CS_SNAPheaplist + TH32CS_SNAPthread + TH32CS_SNAPmodule
'下面的"GetCount" 函数用于返回 2.exe 的个数:
Public Function GetCount()
Dim i As Long, lPid As Long
Dim k As Long
Dim Proc As PROCESSENTRY32
Dim hSnapShot As Long
hSnapShot = CreateToolhelpSnapshot(TH32CS_SNAPall, 0) '获得进程“快照”的句柄
Proc.dwSize = Len(Proc)
lPid = ProcessFirst(hSnapShot, Proc) '获取第一个进程的PROCESSENTRY32结构信息数据
i = 0
k = 0
Do While lPid 0
If InStr(1, Proc.szExeFile, "2.exe", vbTextCompare) 0 Then
k = k + 1
End If
i = i + 1
lPid = ProcessNext(hSnapShot, Proc) '循环获取下一个进程的PROCESSENTRY32结构信息数据
Loop
CloseHandle hSnapShot '关闭进程“快照”句柄
IsDone = k
End Function
VB.net 如何设计多线程运行
Sub Main()
Dim thr As Thread
For Pi As Integer=0 To 4 //启用5线程
MulParams =Pi vbTab sFile vbTab dFile vbTab 1 vbTab DelN vbTab cr vbTab cg vbTab cb vbTab IndexI
GlobalParamas(pi)=MulParams .Split(vbTab)
thr=New Thread(AddressOf MyMulThreadCaller)
thr.Start() //启动多线程进程
Application.DoEvents
Next
End Sub
分享题目:vb.net的多进程 vbnet 多线程
网址分享:http://ybzwz.com/article/doihgpg.html