VB多线程,自慰版。
{:soso_e112:} 都说了是自慰版,不能要求它太多哦。无图{:soso_e141:} Option Explicit
Private Declare Sub RtlMoveMemory Lib "kernel32.dll" (ByRef Destination As Any, ByRef Source As Any, Optional ByVal Length As Long = 4)
Private Declare Function SetTimer Lib "user32.dll" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib "user32.dll" (ByVal hWnd As Long, ByVal nIDEvent As Long) As Long
Private m_pObjMe As Long
Private m_pclsSub As Long
Private m_pSub As Long
Private m_ShellCode(31) As Byte
Private m_hThread As Long
Private m_bExit As Boolean
Event thread()
Private Sub ThreadProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long) '必须要放在首位
Call KillTimer(0, m_hThread)
RaiseEvent thread
End Sub
Public Function CreateThread() As Long
m_hThread = SetTimer(0, 0, 1, m_pSub)
CreateThread = m_hThread
End Function
Public Function TerminateThread()
Call KillTimer(0, m_hThread)
End Function
Private Sub Class_Initialize()
m_pObjMe = ObjPtr(Me)
RtlMoveMemory m_pclsSub, ByVal m_pObjMe
RtlMoveMemory m_pclsSub, ByVal m_pclsSub + 36 '每添加一个Public函数或子过程,这里要+4
m_ShellCode(1) = &H55
m_ShellCode(2) = &H8B
m_ShellCode(3) = &HEC
m_ShellCode(4) = &HFF
m_ShellCode(5) = &H75
m_ShellCode(6) = &H14
m_ShellCode(7) = &HFF
m_ShellCode(8) = &H75
m_ShellCode(9) = &H10
m_ShellCode(10) = &HFF
m_ShellCode(11) = &H75
m_ShellCode(12) = &HC
m_ShellCode(13) = &HFF
m_ShellCode(14) = &H75
m_ShellCode(15) = &H8
m_ShellCode(16) = &H68
m_ShellCode(17) = &H0
m_ShellCode(18) = &H0
m_ShellCode(19) = &H0
m_ShellCode(20) = &H0
m_ShellCode(21) = &HB9
m_ShellCode(22) = &H0
m_ShellCode(23) = &H0
m_ShellCode(24) = &H0
m_ShellCode(25) = &H0
m_ShellCode(26) = &HFF
m_ShellCode(27) = &HD1
m_ShellCode(28) = &HC9
m_ShellCode(29) = &HC2
m_ShellCode(30) = &H10
m_ShellCode(31) = &H0
RtlMoveMemory ByVal VarPtr(m_ShellCode(17)), m_pObjMe
RtlMoveMemory ByVal VarPtr(m_ShellCode(22)), m_pclsSub
m_pSub = VarPtr(m_ShellCode(1))
End Sub
赞!恰到好处的用了汇编
然而定睛一看,这是哪门子多线程,明明就是timer计时器分时操作。 vb学习中,非常有收获 还是用VB.NET吧,VB6过时了 没什么用 啥也不说了,感谢楼主分享哇!
页:
[1]