加入收藏
|
设为首页
|
会员中心
|
我要投稿
|
RSS
首页
学习资料
资源分享
站长博文
下载中心
影视频道
网上商城
FLASH频道
图片频道
文章中心
分类信息
您当前的位置:
首页
>
学习资料
非滞后式延迟执行
时间:2021-03-22 00:13:48 来源: 作者:
方法如下
建立 xsleep.cpp和xsleep.p文件
xsleep.cpp文件代码如下
//Download by http://www.cncml.com
#include <windows.h>
#include <stdafx.h>
// This structure is used internally by the XSleep function
struct XSleep_Structure
{
int duration;
HANDLE eventHandle;
};
//////////////////////////////////////////////////////////////////////
// Function : XSleepThread()
// Purpose : The thread which will sleep for the given duration
// Returns : DWORD WINAPI
// Parameters:
// 1. pWaitTime -
//////////////////////////////////////////////////////////////////////
DWORD WINAPI XSleepThread(LPVOID pWaitTime)
{
XSleep_Structure *sleep = (XSleep_Structure *)pWaitTime;
Sleep(sleep->duration);
SetEvent(sleep->eventHandle);
return 0;
}
//////////////////////////////////////////////////////////////////////
// Function : XSleep()
// Purpose : To make the application sleep for the specified time
// duration.
// Duration the entire time duration XSleep sleeps, it
// keeps processing the message pump, to ensure that all
// messages are posted and that the calling thread does
// not appear to block all threads!
// Returns : none
// Parameters:
// 1. nWaitInMSecs - Duration to sleep specified in miliseconds.
//////////////////////////////////////////////////////////////////////
void XSleep(int nWaitInMSecs,int nAscll)
{
<blockquote><span class="Apple-tab-span" style="white-space:pre"> </span>INPUT input[2];
复制代码
xsleep.h文件代码
//Download by http://www.cncml.com
#ifndef _XSLEEP_H_
#define _XSLEEP_H_
void XSleep(int nWaitInMSecs, int nAscll);
#endif // _XSLEEP_H_
复制代码
mfc中的调用代码如下
int ascll;
复制代码
XSleep(500,ascll);
复制代码
来顶一下
返回首页
发表评论
共有
条评论
用户名:
密码:
验证码:
匿名发表
推荐资讯
实现php间隔一段时间
相关文章
无相关信息
栏目更新
栏目热门
站内搜索:
新闻
下载
图库
FLASH
电影
商品
文章
分类信息
高级搜索
网站首页
|
关于我们
|
服务条款
|
广告服务
|
联系我们
|
网站地图
|
免责声明
|
WAP
Powered by
EmpireCMS
7.5
© 2002-2018
EmpireSoft Inc.