VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)

VB爱好者乐园(VBGood)

 找回密码
 立即注册
搜索
查看: 7544|回复: 4

[讨论] EbExecuteLine 初探

[复制链接]
头像被屏蔽
 楼主| 发表于 2011-7-23 10:19:18 | 显示全部楼层 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2017-11-27 02:51:47 | 显示全部楼层
顶起
原来大侠这么早就已经在研究这个东东了。
回复 支持 反对

使用道具 举报

发表于 2017-11-27 02:50:51 | 显示全部楼层
顶起
原来大侠这么早就已经在研究这个东东了。
回复 支持 反对

使用道具 举报

发表于 2011-7-25 08:39:24 | 显示全部楼层
话说我以前也分析过,写出这样的代码(还没分析完,因此不能使用):
  1. Option Explicit

  2. Public Declare Function EbInitHost Lib "vba6.dll" (ByVal Unknown1 As Long, ByVal Unknown2 As Long, ByVal Unknown3 As Long, ByVal CallbacksAddress As Long, ByVal Unknown4 As Long, ByVal Unknown5 As Long, ByVal Unknown6 As Long, ByVal Unknown7 As Long, ByVal BaseAddress As Long, ByVal hwnd As Long) As Long
  3. Public Declare Function EbInitHostPart2 Lib "vba6.dll" (ByVal pString As Long, ByVal Unknown As Long) As Long
  4. Public Declare Function EbCreateCVbaExtEditors Lib "vba6.dll" (ByVal Unused1 As Long, ByVal Unused2 As Long, ByVal Unused3 As Long, ByVal Pointer As Long) As Long
  5. Public Declare Function EbInvokeItem Lib "vba6.dll" (ByVal Unknown As Long) As Long
  6. Public Declare Function EbExecuteLine Lib "vba6.dll " (ByVal pStringToExec As Long, ByVal Unknownn1 As Long, ByVal Unknownn2 As Long, ByVal fCheckOnly As Long) As Long
  7. Public Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleW" (ByVal lpModuleName As Long) As Long
  8. Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long

  9. Function ExecuteLine(StringToExec As String, ByVal fCheckOnly As Long) As Long
  10.     Dim hVBA6 As Long, Lng(4) As Long, Ptr1(67) As Long, Ptr As Long, MyStr As String, MyVar As Long
  11.     hVBA6 = GetModuleHandle(StrPtr("vba6.dll"))
  12.     If hVBA6 = 0 Then
  13.         hVBA6 = LoadLibrary("vba6.dll")
  14.         MsgBox Hex(hVBA6)
  15.         Lng(0) = &H824448B
  16.         Lng(1) = &HB24C0D8B
  17.         Lng(2) = &H8890059
  18.         Lng(3) = &H8C2C033
  19.         Lng(4) = &H0
  20.         Ptr1(23) = VarPtr(Lng(3))
  21.         Ptr1(59) = VarPtr(Lng(0))
  22.         Ptr1(67) = VarPtr(Lng(3))
  23.         Ptr = VarPtr(Ptr1(0))
  24.         MyStr = "Microsoft Visual Basic"
  25.         EbInitHost 6, 0, &H1FE9, Ptr, &H134, 4, &H4E4, 0, GetModuleHandle(0), 0
  26.         EbInitHostPart2 StrPtr(MyStr), 0
  27.         EbCreateCVbaExtEditors 0, 0, 0, VarPtr(MyVar)
  28.         EbInvokeItem &H1B
  29.     End If
  30.     ExecuteLine = EbExecuteLine(StrPtr(StringToExec), 0, 0, fCheckOnly)
  31. End Function
复制代码

点评

Ptr1变量也是  发表于 2011-7-26 08:12
发现一个问题,Lng变量应该声明为全局变量  发表于 2011-7-26 08:12
EbInitHost 这个函数的参数表, 有单步执行判断, VB6IDE.DLL模块实例的获取, 等等. 这个函数初始化完成, 我想执行代码应该就可以了.... 不过太麻烦了...- - N多的函数...  发表于 2011-7-25 17:42
回复 支持 反对

使用道具 举报

头像被屏蔽
 楼主| 发表于 2011-7-24 15:54:27 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

文字版|手机版|小黑屋|VBGood  

GMT+8, 2022-7-1 22:12

VB爱好者乐园(VBGood)
快速回复 返回顶部 返回列表