找回密码
 立即注册→加入我们

QQ登录

只需一步,快速开始

搜索
热搜: 下载 VB C 实现 编写
查看: 2991|回复: 5

VB多线程,自慰版。

[复制链接]
发表于 2014-7-31 17:55:41 | 显示全部楼层 |阅读模式

欢迎访问技术宅的结界,请注册或者登录吧。

您需要 登录 才可以下载或查看,没有账号?立即注册→加入我们

×
{:soso_e112:} 都说了是自慰版,不能要求它太多哦。
无图{:soso_e141:}
  1. Option Explicit

  2. Private Declare Sub RtlMoveMemory Lib "kernel32.dll" (ByRef Destination As Any, ByRef Source As Any, Optional ByVal Length As Long = 4)
  3. 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
  4. Private Declare Function KillTimer Lib "user32.dll" (ByVal hWnd As Long, ByVal nIDEvent As Long) As Long



  5. Private m_pObjMe As Long
  6. Private m_pclsSub As Long
  7. Private m_pSub As Long
  8. Private m_ShellCode(31) As Byte

  9. Private m_hThread As Long
  10. Private m_bExit As Boolean

  11. Event thread()
  12.    
  13. Private Sub ThreadProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long) '必须要放在首位
  14.     Call KillTimer(0, m_hThread)
  15.     RaiseEvent thread
  16. End Sub


  17. Public Function CreateThread() As Long
  18.     m_hThread = SetTimer(0, 0, 1, m_pSub)
  19.     CreateThread = m_hThread
  20. End Function
  21. Public Function TerminateThread()
  22.      Call KillTimer(0, m_hThread)

  23. End Function




  24. Private Sub Class_Initialize()
  25.     m_pObjMe = ObjPtr(Me)
  26.     RtlMoveMemory m_pclsSub, ByVal m_pObjMe
  27.     RtlMoveMemory m_pclsSub, ByVal m_pclsSub + 36 '每添加一个Public函数或子过程,这里要+4

  28.     m_ShellCode(1) = &H55
  29.     m_ShellCode(2) = &H8B
  30.     m_ShellCode(3) = &HEC
  31.     m_ShellCode(4) = &HFF
  32.     m_ShellCode(5) = &H75
  33.     m_ShellCode(6) = &H14
  34.     m_ShellCode(7) = &HFF
  35.     m_ShellCode(8) = &H75
  36.     m_ShellCode(9) = &H10
  37.     m_ShellCode(10) = &HFF
  38.     m_ShellCode(11) = &H75
  39.     m_ShellCode(12) = &HC
  40.     m_ShellCode(13) = &HFF
  41.     m_ShellCode(14) = &H75
  42.     m_ShellCode(15) = &H8
  43.     m_ShellCode(16) = &H68
  44.     m_ShellCode(17) = &H0
  45.     m_ShellCode(18) = &H0
  46.     m_ShellCode(19) = &H0
  47.     m_ShellCode(20) = &H0
  48.     m_ShellCode(21) = &HB9
  49.     m_ShellCode(22) = &H0
  50.     m_ShellCode(23) = &H0
  51.     m_ShellCode(24) = &H0
  52.     m_ShellCode(25) = &H0
  53.     m_ShellCode(26) = &HFF
  54.     m_ShellCode(27) = &HD1
  55.     m_ShellCode(28) = &HC9
  56.     m_ShellCode(29) = &HC2
  57.     m_ShellCode(30) = &H10
  58.     m_ShellCode(31) = &H0

  59.    
  60.     RtlMoveMemory ByVal VarPtr(m_ShellCode(17)), m_pObjMe
  61.     RtlMoveMemory ByVal VarPtr(m_ShellCode(22)), m_pclsSub
  62.     m_pSub = VarPtr(m_ShellCode(1))
  63. End Sub
复制代码
回复

使用道具 举报

发表于 2014-7-31 22:32:30 | 显示全部楼层
赞!恰到好处的用了汇编

然而定睛一看,这是哪门子多线程,明明就是timer计时器分时操作。
回复 赞! 靠!

使用道具 举报

发表于 2014-12-21 07:11:26 | 显示全部楼层
vb学习中,非常有收获
回复 赞! 靠!

使用道具 举报

发表于 2017-10-25 02:16:32 | 显示全部楼层
还是用VB.NET吧,VB6过时了
回复 赞! 靠!

使用道具 举报

发表于 2023-4-20 00:04:16 | 显示全部楼层
没什么用
回复

使用道具 举报

发表于 2024-9-12 22:16:18 | 显示全部楼层
啥也不说了,感谢楼主分享哇!
回复 赞! 靠!

使用道具 举报

本版积分规则

QQ|Archiver|小黑屋|技术宅的结界 ( 滇ICP备16008837号 )|网站地图

GMT+8, 2024-12-21 22:32 , Processed in 0.036427 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表