' Test on:vb6.0+win2000 and Vb6.0+winxp It ' s pass!
' Create the Thread API
' This API has been modified, lpthreadattributes changed to any type, lpstartaddress changed to a value reference:
' Because the entry address of the function is passed by the parametric, if you use the address, it will pass the parameter variable's addresses instead of the function's entry address.
Private Declare Function createthread Lib "kernel32" (ByVal lpthreadattributes as any, ByVal dwstacksize as Long, ByVal LP Startaddress as Long, lpparameter as any, ByVal dwcreationflags as Long, lpthreadid as long) as long
' Terminate the thread API
Private Declare Function terminatethread Lib "kernel32" (ByVal hthread as Long, ByVal Dwexitcode as long) as long
' Activate the thread API
Private Declare Function resumethread Lib "kernel32" (ByVal Hthread as long) as long
' Suspend the thread API
Private Declare Function suspendthread Lib "kernel32" (ByVal Hthread as long) as long
Public Property Let Threadenabled (ByVal newvalue as Boolean)
On Error Resume Next
' Activate this thread if the activation thread (NewValue is True) is set to True and this thread was not originally activated
If NewValue and (not metheard.enabled) Then
metheard.enabled = True
Else ' Suspend this thread if the thread is activated (NewValue is true) and this thread was originally activated
If metheard.enabled Then
metheard.enabled = False
' Terminate thread events
Private Sub Class_Terminate ()
On Error Resume Next
Call TerminateThread (metheard.handle, 0)
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to firstname.lastname@example.org. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
and provide relevant evidence. A staff member will contact you within 5 working days.