设为首页 加入收藏

TOP

C语言获取开机时间(结合VBS脚本实现语音输出)
2014-11-24 08:24:46 来源: 作者: 【 】 浏览:1
Tags:语言 获取 开机 时间 结合 VBS 脚本 实现 语音 输出

C语言程序部分:


#include
#include
#include


int main ()
{
unsigned long time = 0;
char chr[50];

time = GetTickCount();



int hm = time / 3600000; //hm为小时数
int ms = time % 3600000 / 60000; //ms为分钟数
int se = time % 3600000 % 60000 / 1000; //se为秒数(除以1000是因为time精确到毫秒)



printf("本次开机用时%2d:%2d:%2d", hm, ms, se); //输出时、分、秒);
sprintf(chr, "wscript voice.VBS %d %d", ms, se);
system(chr);
exit(0);
return 0;
}


VBS脚本部分:


Dim args
set args = wscript.arguments
CreateObject("SAPI.SpVoice").Speak "本次开机用时 "&args(0)&"分"&args(1)&"秒"


将VBS脚本保存为voice.VBS与可执行文件保存在同一目录下, 再将可执行文件设为开机启动就可以了.


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Java中Comparator接口的用法 下一篇Python使用subprocess.Popen导致..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·如何理解c语言指针和 (2025-12-27 01:19:11)
·为什么C标准库没有链 (2025-12-27 01:19:08)
·玩转C语言和数据结构 (2025-12-27 01:19:05)
·MySQL 基础入门视频 (2025-12-26 23:20:22)
·小白入门:MySQL超详 (2025-12-26 23:20:19)