绿色风's Blog
专注AutoIT(Au3)
  • 首页
  • 流●年
  • 笔●记
    • 学习随记
    • 源码示例
  • 脚●本
    • UDF(收集)
    • 工作室UDF
    • 工具●教程
    • 教程之GDI
  • 作●品
  • 下●载
  • 情怀ExcelTip
10月192015

笔记本电池电量显示

作者:绿色风   发布:2015-10-19 11:57 Monday   分类:   阅读:4545次   评论:0条  

QQ截图20151019194247.png

```#include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> $INIFile = @ScriptDir & "\Options.ini" If FileExists($INIFile) = 0 Then IniWrite($INIFile, "UIOptions", "Refresh Rate", "500") $RefreshRate = IniRead($INIFile, "UIOptions", "Refresh Rate", "500") Opt("GUIOnEventMode", 1) Global $BatteryPercent = "Please Wait... " Global $BatteryStatus = "Please Wait... " $FormWidth = 410 $FormHeight = 100 $Form1 = GUICreate("笔记本电量 显示示例 v.0.1", 386, 17, @DesktopWidth - $FormWidth, @DesktopHeight - $FormHeight);width height left top GUISetOnEvent($GUI_EVENT_CLOSE, "ExitApp") GUISetBkColor(0xC0C0C0) $Progress1 = GUICtrlCreateProgress(0, 0, 358, 17, BitOR($PBS_SMOOTH, $WS_BORDER)) GUICtrlSetColor(-1, 0x0000FF) $Progress1context = GUICtrlCreateContextMenu($Progress1) $PMenuItem1 = GUICtrlCreateMenuItem("Options", $Progress1context) GUICtrlSetOnEvent($PMenuItem1, "OptionsWindow") $PMenuItem2 = GUICtrlCreateMenu("Close...", $Progress1context) $PMenuItem3 = GUICtrlCreateMenuItem("...To Tray", $PMenuItem2) $PMenuItem4 = GUICtrlCreateMenuItem("...And Exit", $PMenuItem2) GUICtrlSetOnEvent($PMenuItem4, "ExitApp") $Label1 = GUICtrlCreateLabel("", 358, 0, 28, 17, $WS_BORDER);left top width height $Label1context = GUICtrlCreateContextMenu($Label1) $MenuItem1 = GUICtrlCreateMenuItem("Options", $Label1context) $MenuItem2 = GUICtrlCreateMenu("Close...", $Label1context) $MenuItem3 = GUICtrlCreateMenuItem("...To Tray", $MenuItem2) $MenuItem4 = GUICtrlCreateMenuItem("...And Exit", $MenuItem2) GUICtrlSetOnEvent($MenuItem4, "ExitApp") GUISetState(@SW_SHOW) While 1 $SYSTEM_POWER_STATUS = DllStructCreate("byte;byte;byte;byte;int;int") $test = DllCall("kernel32.dll", "int", "GetSystemPowerStatus", _ "ptr", DllStructGetPtr($SYSTEM_POWER_STATUS)) $BatteryStatus = DllStructGetData($SYSTEM_POWER_STATUS, 1) If $BatteryStatus = "1" Then $BatteryStatus = "Charging" If $BatteryStatus = "0" Then $BatteryStatus = "Discharging" $BatteryPercent = DllStructGetData($SYSTEM_POWER_STATUS, 3) GUICtrlSetData($Progress1, $BatteryPercent) GUICtrlSetData($Label1, $BatteryPercent & "%") Sleep($RefreshRate) WEnd Func ExitApp() Exit EndFunc ;==>ExitApp Func OptionsWindow() ;going to do this later EndFunc ;==>OptionsWindow```





本文固定链接: http://www.jianyiit.com/post-145.html

blogger
该日志由 绿色风 于2015-10-19 11:57 Monday发表在 分类下。
版权所有:《绿色风's Blog》 → 《笔记本电池电量显示》;
除特别标注,本博客很多文章均为原创. 互联分享,尊重版权,转载请以链接形式标明本文地址;
本文标签:

扫描二维码,在手机上阅读
上一篇::笑一笑,我真是醉了
下一篇:音量条频率

热门文章

相关文章

  • 黑客帝国特效
  • 解密磊科路由器配置文件获取帐号密码
  • Au3 屏幕取色器
  • AU3两圆切示例
  • au3 gdi旋转的文本-转自德语论坛
取消回复

发表评论

亲,头像对么?

44 + 56 =

提交中,请稍候……


木有头像就木JJ啦!还木有头像吗?点这里申请属于你的个性Gravatar头像吧!


    站点统计
    • 运行时间: 20254 天
    • 日志总数: 365 篇
    • 评论数量: 7240 条
    • 微语数量: 6 条
    • 附件总量: 388 件
  • 逝出的青春

  • 打赏"绿色风"



      扫码关注本站公众号 可搜本站内容

  • Autoit V3 脚本交流群

      常驻群1:905774875
      常驻群2:40672266


  • 链接

    • AU3中文论坛
    • Excel资料库
    • 完美者博客
    • 顺网小哥'S Blog
    • 猛牛哥的博客
    • 网吧系统下载
  • 分类

    • 流●年(66)
    • 笔●记(0)
    • 脚●本(0)
    • 作品(21)
    • 学习随记(51)
    • 源码示例(68)
    • UDF(收集)(26)
    • 工作室UDF(30)
    • 工具●教程(62)
    • 教程之GDI(24)
Copyright © 2013 绿色风's Blog. Powered by emlog. Theme by 射雕天龙. 鄂ICP备2021011689号-1 鄂公网安备42102302000078号 sitemap