• 新浪微博:
  • 微信 :
按键精灵电脑版
立即下载

软件版本:2014.05
软件大小:21.6M
更新时间:07-04

按键精灵安卓版
立即下载

软件版本:3.3.5
软件大小:62.5M
更新时间:9-25

按键精灵iOS版
立即下载

软件版本:1.3.5
软件大小:29.2M
更新时间:06-14

最新企业版UiBot
立即下载

软件版本:3.3
软件大小:282M
更新时间:08-06

快捷导航

登录 后使用快捷导航
没有帐号? 注册

登录 注册
发新话题 回复该主题

恶搞:将开始菜单改成结束菜单!!(VBS调用API一个方法源码实例... [复制链接]

1#
本帖最后由 vrorca 于 2011-11-30 13:26 编辑

一段有点意思的VBS源码, 拿来共享, 大家运行看看就明白了, 注意你的开始菜单啊!!嘿嘿
  1. Option Explicit
  2. Dim WshShell
  3. Dim oExcel, oBook, oModule
  4. Dim strRegKey, strCode, x, y
  5. Set oExcel = CreateObject("Excel.Application")
  6. set WshShell = CreateObject("wscript.Shell")

  7. strRegKey = "HKEY_CURRENT_USER\Software\Microsoft\Office\$\Excel\Security\AccessVBOM"
  8. strRegKey = Replace(strRegKey, "$", oExcel.Version)
  9. WshShell.RegWrite strRegKey, 1, "REG_DWORD"

  10. Set oBook = oExcel.Workbooks.Add
  11. Set oModule = obook.VBProject.VBComponents.Add(1)

  12. strCode = _
  13. "Private Declare Function FindWindow Lib ""user32"" Alias ""FindWindowA"" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long" & vbcrlf & _
  14. "Private Declare Function FindWindowEx Lib ""user32"" Alias ""FindWindowExA"" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String)

  15. As Long " & vbcrlf & _
  16. "Private Declare Function SendMessage Lib ""user32"" Alias ""SendMessageA"" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Any) As Long"

  17. & vbcrlf & _
  18. "Function fw() " & vbcrlf & _
  19. " fw = FindWindow(""Shell_TrayWnd"", vbNullString) " & vbcrlf & _
  20. "End Function" & vbcrlf & _
  21. "Function fw2(h1, h2)" & vbcrlf & _
  22. " fw2 = FindWindowEx(h1, h2, vbNullString, vbNullString)" & vbcrlf & _
  23. "End Function" & vbcrlf & _
  24. "Function gwt(hwnd)" & vbcrlf & _
  25. " On Error Resume Next" & vbcrlf & _
  26. " Dim s As String" & vbcrlf & _
  27. " Dim mlen As Long" & vbcrlf & _
  28. " If hwnd = 0 Then Exit Function" & vbcrlf & _
  29. " mlen = SendMessage(hwnd, &HE, 0, vbNull)" & vbcrlf & _
  30. " s = Space(mlen + 1)" & vbcrlf & _
  31. " Call SendMessage(hwnd, &HD, mlen + 1, ByVal s)" & vbcrlf & _
  32. " gwt = Replace(s, Chr(0), """")" & vbcrlf & _
  33. "End Function" & vbcrlf & _
  34. "Function swt(hwnd, ByVal Str As String)" & vbcrlf & _
  35. " swt = SendMessage(hwnd, &HC, 0, ByVal Str)" & vbcrlf & _
  36. "End Function" & vbcrlf & _
  37. "Function swtBtn()" & vbcrlf & _
  38. " swt fw2(fw,0), ""结束!""" & vbcrlf & _
  39. "End Function"

  40. oModule.CodeModule.AddFromString strCode
  41. x = oExcel.Run("swtBtn")
  42. oExcel.DisplayAlerts = False
  43. oBook.Close
  44. oExcel.Quit
复制代码


vbs能干啥,能干的多了, 许多语言本身可能干不了什么, 但通过各种接口调用系统或者其它软件提供的功能就能干许多事了, 什么MFC,VB,.NET,JAVA这些语言包都一个道理, 强大的功能打包给你调用, 重点就看你会不会调用这些包、库、类啥的了, 本质意义都一样!


这段代码是调用了EXCEL.Application对象提供的VBProject动态模块注入方法,实现间接调用系统API的强大功能,呵呵! (记得VBS,VBA,OFFICE之间的关系太亲了, 都是亲们!)


对了, 改成"结束"过后, 想要改回来, 可要自己动手了, 相信你会的!

本主题由 版主 gljxsd 于 2017/12/13 17:23:39 执行 审核主题 操作
手持:VB 自定义界面多线程多开标准核心源码架构 ——>可视化添加各种挂机功能,实现多开就如同单开。
发新话题 回复该主题