添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. VB6 CreateThread,it can build a com object or form object.
child thread can use public var ,public object,public ocx.
we can use more cpu to Show better interface display。
chinese:中国人发明的最佳的VB6多线程,支持第三方OCX控件,支持”自定义控件“,支持com对象等。
可能很少有人用到这个功能,但是做到这些那就完美了。
在多线程中可以共享全局变量,创建窗口,动态添加控件,访问控件,各个子线程之间可以相互调用彼此的对象或控件(注意临界许可证之类就行了).
用途:比如在一个进程中加载多个Webbrowser控件或表格控件等CPU任务繁重的部件,在多线程中调用他,实现提现,充分利用CPU。
'-=================
Code:
call CreateThread(addressof test)
sub test()
dim a as xmlhttp
dim b as form2
set b=new form2
dim c as object
set c=CreateObject("MSScriptControl.ScriptControl")
dim d as Class1
set D=NEW class1
end sub
no need any tlb,no need any "CreatePrivateObjectByNameInNewThread"
DOWNLOAD HERE,THE FIRST IS BEST.
FOR FIX SUPPORT OCX,Running speed is too slow, who can help me change faster, less code? As noted in the other thread, this forum does not allow the posting of compiled code (exe, dll, etc). The rest of the attachments looked like a reasonable project, but I had to remove the attachments. Please edit them to remove the compiled portions, then re-attach. If people want to compile it, they can do so. @Shaggy Hiker,sorry,i don't know how to delete one reply when write error info.
and i also don't know how can i @you,may be only can reply your message ?
my code for vb6 "CreateThread" is very easy,and it's not the best code(that's only for my work)
vb6 is the best “Programming development language“,in china ,we Streamline software(VB6.zip),ONLY 10Mb,when setup ok,it's only 30MB.
VB6 Very compact.
IT'S SUPPORT MAKE( console program ,STAND STDCALL DLL,COM DLL,ACTIVEX.EXE)
vb6 is the best,So we don't need to learn (vc,vb.net,c#)

------------------------
aout:
Yeah, re-attach without the compiled code and it will be fine. It's kind of nice, these days, that we can be fairly multilingual. I looked at your example code, took a few of the Chinese comments, ran them through Google Translate, and was able to read them just fine. That one tool is so useful, these days. i use vb6 Many years,we can be friend,welcome.
in china,we have freebasic ide,it's name:visual freebasic.
download url: http://www.yfvb.com/soft-48.htm
QQ GROUP:78458582
IT'S EASY FOR CreateThread ,and it's easy for support make 64 bit exe.
let's Learning together。
my QQ:2776478814
MY EMAIL:xiaoyaocode$163.com ($ change to @) sometimes,Google Translate will Inaccurate translation.so for best,can i use chinese and english?
my project code have no Notes,have more chinese Notes.
if chinese pepole view this word,will study quick.
因为有时谷歌翻译会出错,表达意思不准确。我有时想写的内容同时用中文和英文。
我的工程代码里面大部分没有写注释,有很多是中文注释,中国人看到这个贴子时学起来就快了。 about : http://www.vbforums.com/showthread.p...reading-a-LOOP
I've always found the topic of Multi threading somewhat too involved in VB.
I have a BIG loop of items that process a batch of files. Normally takes 30+ mins to complete.
Would be nice to be able to figure out how to enable MultiThreading in VB so I could speed up this loop.
Any templates to get me started?
----------------------------
answer:
if your cpu like i5 8600k(6 cpu core,Maybe you can you 6 thread or 12 thread)
you have 10000 plans,put in arr planlist(10000) as string
so 6 thread use 6 plan,when one thread finished,use plan 7.
so your cpu will be used for best.
yor also can view taskmgr.exe(if your cpu only use 30%),you can use 18 threads
VB6 CreateThread,it can build a com object or form object.
child thread can use public var ,public object,public ocx.
we can use more cpu to Show better interface display。
chinese:中国人发明的最佳的VB6多线程,支持第三方OCX控件,支持”自定义控件“,支持com对象等。
可能很少有人用到这个功能,但是做到这些那就完美了。
在多线程中可以共享全局变量,创建窗口,动态添加控件,访问控件,各个子线程之间可以相互调用彼此的对象或控件(注意临界许可证之类就行了).
用途:比如在一个进程中加载多个Webbrowser控件或表格控件等CPU任务繁重的部件,在多线程中调用他,实现提现,充分利用CPU。
'-=================
Code:
call CreateThread(addressof test)
sub test()
dim a as xmlhttp
dim b as form2
set b=new form2
dim c as object
set c=CreateObject("MSScriptControl.ScriptControl")
dim d as Class1
set D=NEW class1
end sub
no need any tlb,no need any "CreatePrivateObjectByNameInNewThread"
DOWNLOAD HERE,THE FIRST IS BEST.
FOR FIX SUPPORT OCX, Running speed is too slow , who can help me change faster, less code? May be the following msvbvm60 runtime api from msvbvm60.dll of help to you.
EbLoadRunTime
EbCreateContext
EbSetContextWorkerThread
regards,
JSVenu May be the following msvbvm60 runtime api from msvbvm60.dll of help to you.
EbLoadRunTime
EbCreateContext
EbSetContextWorkerThread
regards,
JSVenu Dear xiaoyao,
You can find how to use the above runtime API at the following link.
https://www.planet-source-code.com/v...50144&lngWId=1
Here even the free threading component and various threading examples are given.
But ASM is also used along with VB6 for generating the free threading component using above apis.I have less knowledge in ASM.
You can take a look here and may take support of Trick for any help regarding multithreading .
regards,
JSVenu method2 by friend:The trick) stand exe-thread ,can't support (usercontrols),how to fix it?
how to add usecontrols on form object in thread?
(your project can add ocx,but can't support vb6 usercontrol)

1,make ocx (TestOCX.vbp)
2,make exe(#FormThreading.vbp)
run exe
Code:
Private obj As Object
Private Sub Command1_Click()
On Error GoTo ERR
Set obj = Me.Controls.Add("Project1.UserControl1", "UserControl1B")
obj.Visible = True
MsgBox obj.Width
  Exit Sub
  MsgBox "ERR:" & ERR.Number & "," & ERR.Description
End Sub
sub test2
Dim ctlName As Control
Set ctlName = Form1.Controls.Add("Project1.UserControl1", "Text1", Form1)
ctlName.Visible = True
end sub
Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.