using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms;namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } public const int WM_TIMECHANGE = 30; protected override void WndProc(ref Message m) { if (m.Msg == WM_TIMECHANGE) { MessageBox.Show("系统时间被更改了!!!"); } base.WndProc(ref m); } } }我这个简单好用.
比如500ms一次。
tTime=Date.now
if ( math.abs( LastTime-tTime ) > 550 ) '定时器有一定误差,所以定值多加50ms
{ '时间变了
}
LastTime=tTime
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} public const int WM_TIMECHANGE = 30;
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_TIMECHANGE)
{
MessageBox.Show("系统时间被更改了!!!");
}
base.WndProc(ref m);
}
}
}我这个简单好用.