赞 | 12 |
VIP | 107 |
好人卡 | 6 |
积分 | 4 |
经验 | 31122 |
最后登录 | 2024-6-29 |
在线时间 | 1606 小时 |
Lv2.观梦者 傻♂逼
- 梦石
- 0
- 星屑
- 374
- 在线时间
- 1606 小时
- 注册时间
- 2007-3-13
- 帖子
- 6562
|
蕾米莉亚·斯卡雷特 发表于 2011-4-19 16:39
回复 yangff 的帖子
居然可以? = =
- #==============================================================================
- # ■ Kernel
- #------------------------------------------------------------------------------
- # 该模块中定义了可供所有类使用的方法。Object 类中包含了该模块。
- #==============================================================================
- module Kernel
- #--------------------------------------------------------------------------
- # ● 需要的 Windows API 函数
- #--------------------------------------------------------------------------
- #没有定制的Game的话……
- GetWindowLong=Win32API.new('User32','GetWindowLongA','ll','l')
- SetWindowLong= Win32API.new('User32','SetWindowLongA','lll','l')
- GetWindowThreadProcessId = Win32API.new("user32", "GetWindowThreadProcessId", "LP", "L")
- GetWindow = Win32API.new("user32", "GetWindow", "LL", "L")
- GetClassName = Win32API.new("user32", "GetClassName", "LPL", "L")
- GetCurrentThreadId = Win32API.new("kernel32", "GetCurrentThreadId", "V", "L")
- GetForegroundWindow = Win32API.new("user32", "GetForegroundWindow", "V", "L")#CreateWindowEx(
- $hInstance=Win32API.new("Kernel32","GetModuleHandleA","","l").call()
- #DWORD dwExStyle,LPCTSTR IpClassName,
- #LPCTSTR lpWindowName,DWORD dwStyle,
- #int x,int y,int nWidth,int nHeight,
- #HWND hWndParent,HMENU hMenu,
- #HANDLE hInstance,LPVOID lpParam);
- module WS
- EX_MDICHILD=0x40
- EX_WINDOWEDGE=0x100
- #CHILD=0x40000000
- #VISIBLE=0x10000000
- OVERLAPPED = 0x00000000
- POPUP = 0x80000000
- CHILD = 0x40000000
- MINIMIZE = 0x20000000
- VISIBLE = 0x10000000
- DISABLED = 0x08000000
- CLIPSIBLINGS = 0x04000000
- CLIPCHILDREN = 0x02000000
- MAXIMIZE = 0x01000000
- CAPTION = 0x00C00000
- BORDER = 0x00800000
- DLGFRAME = 0x00400000
- VSCROLL = 0x00200000
- HSCROLL = 0x00100000
- SYSMENU = 0x00080000
- THICKFRAME = 0x00040000
- GROUP = 0x00020000
- TABSTOP = 0x00010000
- MINIMIZEBOX = 0x00020000
- end
- @hh=0
- CWE = Win32API.new('user32','CreateWindowEx','lppllllllllp','l')
- def self.make_window(x,y,width,height) #return hwnd
- #p $hInstance
- CWE.call(WS::EX_WINDOWEDGE,'RGSS Player','CWebB',WS::CHILD|WS::VISIBLE,x,y,width,height,get_hWnd,0,$hInstance,0)
- #CreateWindowEx.call(1, "Edit", "", W, 0, 0, w, h, GetActiveWindow.call, 1, GetModuleHandle.call(nil), 1)
- end
- #--------------------------------------------------------------------------
- # ● 获取窗口句柄
- #--------------------------------------------------------------------------
- def self.get_hWnd
- return @hh if @hh!=0
- # 获取调用线程(RM 的主线程)的进程标识
- threadID = GetCurrentThreadId.call
- # 获取 Z 次序中最靠前的窗口
- hWnd = GetWindow.call(GetForegroundWindow.call, 0)
- # 枚举所有窗口
- while hWnd != 0
- # 如果创建该窗口的线程标识匹配本线程标识
- if threadID == GetWindowThreadProcessId.call(hWnd, 0)
- # 分配一个 11 个字节的缓冲区
- className = " " * 11
- # 获取该窗口的类名
- GetClassName.call(hWnd, className, 12)
- # 如果匹配 RGSS Player 则跳出循环
- break if className == "RGSS Player"
- end
- # 获取下一个窗口
- hWnd = GetWindow.call(hWnd, 2)
- end
- return @hh=hWnd
- end
- end
- os=GetWindowLong.call(Kernel.get_hWnd,-16)
- SetWindowLong.call(Kernel.get_hWnd,-16,os | 33554432)
复制代码 那就这样…… |
|