赞 | 6 |
VIP | 356 |
好人卡 | 3 |
积分 | 2 |
经验 | 297560 |
最后登录 | 2022-1-18 |
在线时间 | 509 小时 |
Lv1.梦旅人 有事烧纸
- 梦石
- 0
- 星屑
- 154
- 在线时间
- 509 小时
- 注册时间
- 2005-10-22
- 帖子
- 6982
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
咳咳。。。RM 托盘程序。。。= = 以前ms很多人想要这个东西``{/gg}{/gg}
不介绍了
1.04最新版下载
更新全RGSS设置,包括各种信息,处理,自定义选项等。使用说明参考注释。
- unless defined? RM_Tray
- #==========================================================================
- # ■ RM_Tray v1.04
- #--------------------------------------------------------------------------
- # RM窗口托盘模块。
- #==========================================================================
- module RM_Tray
- #--------------------------------------------------------------------------
- # ● 定义常量
- #--------------------------------------------------------------------------
- NIIF_INFO = 0x00000001 # 气球普通提示
- NIIF_WARNING = 0x00000002 # 气球警告提示
- NIIF_ERROR = 0x00000003 # 气球错误提示
-
- DEFAULT_TIP = "RM Tray is Running! - -bb" # 鼠标经过托盘时的提示信息
- DEFALUT_INFO = "RM 游戏开始运行 - -bbb !" # 游戏开始的时候提示信息内容
- DEFAULT_INFOTITLE = "Hi" # 游戏开始的时候提示信息标题
-
- # PS: 不提示,把信息设置为 nil 即可。
-
- #--------------------------------------------------------------------------
- # ● API声明
- #--------------------------------------------------------------------------
- ADD_TRAY = Win32API.new("RMTray","_add_tray","ppp","v")
- MODIFY_TIP = Win32API.new("RMTray","_modify_tip","p","v")
- SUPPORT_BALLOON = Win32API.new("RMTray","_support_balloon","v","i")
- SHOW_BALLOON = Win32API.new("RMTray","_show_balloon","ppil","v")
- REMOVE_TRAY = Win32API.new("RMTray","_remove_tray","v","v")
- API_REGISTER = Win32API.new("RMTray","_register", "lipp", "i")
-
- API_RESTORE = Win32API.new("RMTray","_restore_window","v","v")
-
- #--------------------------------------------------------------------------
- # ● 功能函数01: 查找窗口
- #--------------------------------------------------------------------------
- def self.findWindow
- Win32API.new("user32","FindWindow","pp","i").call("RGSS Player",readIni)
- end
-
- #--------------------------------------------------------------------------
- # ● 功能函数02:读取Ini文件
- #--------------------------------------------------------------------------
- def self.readIni(item = "Title")
- buf = 0.chr * 256
- gpps = Win32API.new("kernel32","GetPrivateProfileString","pppplp","l")
- gpps.call("Game",item,"",buf,256,"./Game.ini")
- buf.delete!("\0")
- return buf
- end
-
- #--------------------------------------------------------------------------
- # ● 定义常量:窗口句柄
- #--------------------------------------------------------------------------
- HWND = findWindow
-
- #--------------------------------------------------------------------------
- # ● 特殊方法:窗口转向后台时的提示信息
- #--------------------------------------------------------------------------
- def self.hide_window_info
- self.show_balloon("提示", "最小化到后台运行", 10000, NIIF_INFO)
- end
-
- #--------------------------------------------------------------------------
- # ● 托盘操作方法:加载托盘
- #--------------------------------------------------------------------------
- def self.add_tray(tip = DEFAULT_TIP, info = DEFALUT_INFO, title = DEFAULT_INFOTITLE)
- ADD_TRAY.call tip, info, title
- end
-
- #--------------------------------------------------------------------------
- # ● 托盘操作方法:修改鼠标经过的提示信息
- #--------------------------------------------------------------------------
- def self.modify_tip(str)
- MODIFY_TIP.call(str)
- end
-
- #--------------------------------------------------------------------------
- # ● 托盘操作方法:检查是否支持气球提示
- #--------------------------------------------------------------------------
- def self.support_balloon?
- return SUPPORT_BALLOON.call != 0
- end
-
- #--------------------------------------------------------------------------
- # ● 托盘操作方法:显示气球提示
- #--------------------------------------------------------------------------
- def self.show_balloon(title,str,timeout = 10000,flags = NIIF_INFO)
- SHOW_BALLOON.call(title,str,timeout,flags) if support_balloon?
- end
-
- #--------------------------------------------------------------------------
- # ● 托盘操作方法:移除托盘
- #--------------------------------------------------------------------------
- def self.remove_tray
- REMOVE_TRAY.call
- end
-
- #--------------------------------------------------------------------------
- # ● 回调方法:RM_Tray.restore
- #--------------------------------------------------------------------------
- def self.restore
- p "restore"
- API_RESTORE.call
- end
-
- #--------------------------------------------------------------------------
- # ● 回调方法:RM_Tray.about
- #--------------------------------------------------------------------------
- def self.about
- p "about"
- Win32API.new("user32", "MessageBox", "lppi", "i").call 0,
- "RMTray V1.04 ! - -bb from 66RPG!",
- "hi",
- 0x00000040
- end
-
- #--------------------------------------------------------------------------
- # ● 回调方法:RM_Tray.gotobbs
- #--------------------------------------------------------------------------
- def self.gotobbs
- p "gotobbs"
- Win32API.new("shell32", "ShellExecute", "lppppi", "l").call 0, nil, "http://rpg.blue/bbs", nil, nil, 1
- end
-
- #--------------------------------------------------------------------------
- # ● 回调方法:RM_Tray.exit
- #--------------------------------------------------------------------------
- def self.exit
- p "exit"
- Win32API.new("user32","DestroyWindow", "l", "i").call HWND
- end
-
- =begin
- 关于 RM_Tray.register 方法。
-
- 该方法用于给托盘的弹出菜单注册菜单项,每一项为包含4个元素的数组,
- 其中第一个参数用于指定菜单项的风格;
- MF_STRING - 字符串
- MF_GRAYED - 灰色(无效)化
- MF_SEPARATOR - 分割线
- 第二个参数用于指定一个菜单项的ID号;
- 第三个参数用于指定对应的字符串,如果MF_SEPARATOR的情况传递nil;
- 第四个参数指定一个“可执行”的字符串。
-
- =end
- #--------------------------------------------------------------------------
- # ● 设置菜单项状态用API:MF_ENABLED、MF_DISABLED、MF_GRAYED 三个状态
- #--------------------------------------------------------------------------
- API_SETITEMSTATE = Win32API.new("RMTray", "_set_item_state", "ii", "v")
- MF_ENABLED = 0x00000000
- MF_DISABLED = 0x00000002
-
- MF_GRAYED = 0x00000001
-
- MF_STRING = 0x00000000
- MF_SEPARATOR = 0x00000800
-
- def self.register
- [
- [MF_STRING | MF_GRAYED, 0, "还原(&R)", "RM_Tray.restore"],
- [MF_STRING, 1, "关于(&A)", "RM_Tray.about"],
- [MF_SEPARATOR, 2, nil, nil],
- [MF_STRING, 3, "前往论坛", "RM_Tray.gotobbs"],
- [MF_SEPARATOR, 4, nil, nil],
- [MF_STRING, 5, "退出(&C)", "RM_Tray.exit"]
- ].each do |arr|
- API_REGISTER.call *arr
- end
- end
-
- #--------------------------------------------------------------------------
- # ● 简单启动句柄
- #--------------------------------------------------------------------------
- def self.start
- self.register
- self.add_tray
- end
- end
- RM_Tray.start
-
- end
复制代码
1.03版下载
更新了一些气球提示什么的,可以在RM事件里直接操作提示信息。具体的看工程好了,咳= =
点击下载范例工程
以下为几张效果图= =bb
ps:这只素一个初版,至于以后更不更新就不知道呢。。。咳 闪人。。= =bb
|
|