ruby 调用 win api

cnrefresh 2007-10-16 09:22:03
有没有相关资料。在线等待!
...全文
144 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
javalsnwan 2008-08-19
  • 打赏
  • 举报
回复
那用ruby截屏 怎么做呢 请指教
python二级题库 2007-10-17
  • 打赏
  • 举报
回复
開啟IE瀏覽器:
require 'win32ole'


ie = WIN32OLE.new('InternetExplorer.Application')


ie.visible = true

ie.navigate('http://www.google.com')

ie.gohome

ie.quit

system('pause')
python二级题库 2007-10-17
  • 打赏
  • 举报
回复
例子:獲取鼠標的坐標

require 'Win32API'
getCursorPos = Win32API.new("user32", "GetCursorPos", ['P'], 'V')


lpPoint = " " * 8
getCursorPos.Call(lpPoint)

x, y = lpPoint.unpack("LL")

print "x: ", x, "\n"
print "y: ", y, "\n"

ods = Win32API.new("kernel32", "OutputDebugString", ['P'], 'V')
ods.Call("Hello, World\n")

GetDesktopWindow = Win32API.new("user32", "GetDesktopWindow", [], 'L')
GetActiveWindow = Win32API.new("user32", "GetActiveWindow", [], 'L')

SendMessage = Win32API.new("user32", "SendMessage", ['L'] * 4, 'L')
SendMessage.Call GetDesktopWindow.Call, 274, 0xf140, 0

2,763

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ruby/Rails
社区管理员
  • Ruby/Rails社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧