找出自我的程序上次运行以来计算机是否重新启动? [英] Find out if computer rebooted since the last time my program ran?

查看:24
本文介绍了找出自我的程序上次运行以来计算机是否重新启动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的程序如何知道自上次运行以来 Windows 是否重新启动?所有版本的 Windows XP 及更高版本.

How can my program know if windows rebooted since the last time it ran? All versions of windows XP and on.

推荐答案

这可以使用 全局原子表.只要确保您的原子名称不太可能与另一个原子冲突.

This can be accomplished trivially using the global atom table. Just make sure your atom name is unlikely to conflict with another atom.

if (GlobalFindAtom ("MySecretName") == 0)
{
  // First time run since reboot
  GlobalAddAtom ("MySecretName");
}

这篇关于找出自我的程序上次运行以来计算机是否重新启动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆