开启辅助访问 切换到宽版

精易论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

用微信号发送消息登录论坛

新人指南 邀请好友注册 - 我关注人的新帖 教你赚取精币 - 每日签到


求职/招聘- 论坛接单- 开发者大厅

论坛版规 总版规 - 建议/投诉 - 应聘版主 - 精华帖总集 积分说明 - 禁言标准 - 有奖举报

查看: 1836|回复: 0
打印 上一主题 下一主题
收起左侧

[C#源码] C# TIMER Class

[复制链接]
结帖率:33% (3/9)
跳转到指定楼层
楼主
发表于 2012-11-23 19:38:58 | 只看该作者 |只看大图 回帖奖励 |正序浏览 |阅读模式   四川省成都市
Timer.rar (659 Bytes, 下载次数: 1)
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.ComponentModel;
  6. using System.Runtime.InteropServices;
  7. namespace ClassLibrary1 // 名字空间
  8. {
  9.     public class Timer
  10.     {
  11.         // SetTimer
  12.         [DllImport("user32.dll", EntryPoint = "SetTimer")]
  13.         private static extern int SetTimer(int hwnd, int nIDEvent, int uElapse, int lpTimerFunc);
  14.         public int 设置时钟(int 窗口句柄, int 事件标识符, int 时钟周期, int 子程序指针)
  15.         {
  16.             int d = SetTimer(窗口句柄, 事件标识符, 时钟周期, 子程序指针);
  17.             return d;
  18.         }
  19.         // 设置时钟...计时器...不所与高精度
  20.         [DllImport("user32.dll", EntryPoint = "KillTimer")]
  21.         private static extern int KillTimer(int hwnd, int nIDEvent);
  22.         public bool 销毁时钟(int 窗口句柄, int 事件表示符)
  23.         {
  24.             int d = KillTimer(窗口句柄,事件表示符);
  25.             if (d > 0)
  26.             {
  27.                 return true;
  28.             }
  29.             else
  30.             {
  31.                 return false;
  32.             }
  33.         }
  34.         // 销毁时钟
  35.         [DllImport("user32.dll", EntryPoint = "GetMessageTime")]
  36.         private static extern int GetMessageTime();
  37.         public int 取函数执行时间()
  38.         {
  39.             return GetMessageTime();
  40.         }
  41.     }
  42. }
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 致发广告者

发布主题 收藏帖子 返回列表

sitemap| 易语言源码| 易语言教程| 易语言论坛| 易语言模块| 手机版| 广告投放| 精易论坛
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论,本站内容均为会员发表,并不代表精易立场!
论坛帖子内容仅用于技术交流学习和研究的目的,严禁用于非法目的,否则造成一切后果自负!如帖子内容侵害到你的权益,请联系我们!
防范网络诈骗,远离网络犯罪 违法和不良信息举报电话0663-3422125,QQ: 793400750,邮箱:[email protected]
网站简介:精易论坛成立于2009年,是一个程序设计学习交流技术论坛,隶属于揭阳市揭东区精易科技有限公司所有。
Powered by Discuz! X3.4 揭阳市揭东区精易科技有限公司 ( 粤ICP备12094385号-1) 粤公网安备 44522102000125 增值电信业务经营许可证 粤B2-20192173

快速回复 返回顶部 返回列表