CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  进程/线程/DLL

大侠们来看看啊! 小弟没则了!!!!!!!!!!!!!!!!翘首等待!!!!

楼主why168()2004-08-01 08:07:10 在 VC/MFC / 进程/线程/DLL 提问

我自己用c写了个DLL,想在里面使用Timer,可以实现吗?  
  如果能要怎样做了,谢谢啊!!!!!!!!!!!!!!!!!!!!!!!!1  
  问题点数:0、回复次数:8Top

1 楼why168()回复于 2004-08-01 08:27:03 得分 0

我自己   顶     顶   顶Top

2 楼afc(afc)回复于 2004-08-01 08:40:22 得分 0

应该可以呀,给SetTimer设置一个回调函数就可以了  
   
  The   SetTimer   function   creates   a   timer   with   the   specified   time-out   value.    
   
  Syntax  
   
  UINT_PTR   SetTimer(                     HWND   hWnd,  
          UINT_PTR   nIDEvent,  
          UINT   uElapse,  
          TIMERPROC   lpTimerFunc  
  );  
  Parameters  
   
  hWnd  
  [in]   Handle   to   the   window   to   be   associated   with   the   timer.   This   window   must   be   owned   by   the   calling   thread.   If   this   parameter   is   NULL,   no   window   is   associated   with   the   timer   and   the   nIDEvent   parameter   is   ignored.    
  nIDEvent  
  [in]   Specifies   a   nonzero   timer   identifier.   If   the   hWnd   parameter   is   NULL,   this   parameter   is   ignored.   If   the   hWnd   parameter   is   not   NULL   and   the   window   specified   by   hWnd   already   has   a   timer   with   the   value   nIDEvent,   then   the   existing   timer   is   replaced   by   the   new   timer.   When   SetTimer   replaces   a   timer,   the   timer   is   reset.   Therefore,   a   message   will   be   sent   after   the   current   time-out   value   elapses,   but   the   previously   set   time-out   value   is   ignored.    
  uElapse  
  [in]   Specifies   the   time-out   value,   in   milliseconds.    
  Windows   NT/2000/XP:   If   uElapse   is   greater   than   0x7fffffff,   the   timeout   is   set   to   1.  
   
  Windows   2000/XP:   If   uElapse   is   less   than   10,   the   timeout   is   set   to   10.  
   
  Windows   .Net   Server:   If   uElapse   is   greater   than   0x7fffffff,   the   timeout   is   set   to   0x7fffffff.    
   
  lpTimerFunc  
  [in]   Pointer   to   the   function   to   be   notified   when   the   time-out   value   elapses.   For   more   information   about   the   function,   see   TimerProc.   If   lpTimerFunc   is   NULL,   the   system   posts   a   WM_TIMER   message   to   the   application   queue.   The   hwnd   member   of   the   message's   MSG   structure   contains   the   value   of   the   hWnd   parameterTop

3 楼why168()回复于 2004-08-01 09:09:39 得分 0

有点   例子吗Top

4 楼howtotell(从何谈起)回复于 2004-08-01 09:58:06 得分 0

int   nTimeer=SetTimer(g_hFlyWin,   1,200/*ms*/,   (TIMERPROC)TimerProc);  
  void   CALLBACK   (HWND   hwnd,   UINT   msg,   UINT   idTimer,   DWORD   dwTime)  
  {  
   
  PostMessage(...);      
   
  return;  
  }  
  Top

5 楼sohou(2007的春天)回复于 2004-08-03 16:05:23 得分 0

是实现定时吗?你到FAQ里面去找找,一大把Top

6 楼sohou(2007的春天)回复于 2004-08-03 16:05:53 得分 0

http://community.csdn.net/Expert/topic/2976/2976936.xml?temp=.1842157Top

7 楼Daniel22_cn(我爱我老婆)回复于 2004-08-04 12:01:19 得分 0

楼主,标题里面有错别字.Top

8 楼Daniel22_cn(我爱我老婆)回复于 2004-08-04 12:04:41 得分 0

事实证明,没有窗体,也可以SetTimer,但必须要使用GetMessage   DispatchMessage..  
   
  #include   "stdafx.h"  
   
  VOID   CALLBACK   TimerProc(HWND   hWnd,   UINT   uMsg,   UINT   idEvent,   DWORD   dwTime);  
   
  int   APIENTRY   WinMain(HINSTANCE   hInstance,  
  HINSTANCE   hPrevInstance,  
  LPSTR   lpCmdLine,  
  int   nCmdShow)  
  {  
  int   m_nTimerID=SetTimer(   NULL   ,   13   ,   5*1000,   (TIMERPROC)TimerProc);    
   
  MSG   msg;  
  while   (GetMessage(&msg,   NULL,   0,   0))    
  {  
  DispatchMessage(&msg);  
  }  
  return   0;  
  }  
   
   
  VOID   CALLBACK   TimerProc(HWND   hWnd,   UINT   uMsg,   UINT   idEvent,   DWORD   dwTime)  
  {  
  MessageBox(hWnd,   "haha!   it   ...",   "",   MB_OK);  
  }  
   
  Top

相关问题

  • 还没有入门 在线等待???
  • 大虾们,Help Me!---在线等待!!!
  • 高手们帮帮我(在线等待)
  • 兄弟们,有没有更好的方法来解决这个进程等待的问题
  • 为什么我装的系统(win2000pro)关机选项里面没有等待一项!---在线等待,高分
  • 兄弟们,瞧你们的了!在线等待。保证给分
  • 十万火急:爱情来了怎么处理?还没有设计这个接口呀,兄弟们帮忙,在线等待中!!!!!!!!!!!!!!!!!!!!!!!!
  • 请高手们解决问题,在线等待 .................花儿都谢了,上次那个帖子还是没人解决
  • 麻烦看我中木马了没有???急!!!在线等待
  • 还没入门的问题,在线等待,立刻给分。

关键词

  • .net
  • null
  • timerproc
  • settimer
  • timer
  • nidevent
  • hwnd
  • uint
  • hinstance
  • msg

得分解答快速导航

  • 帖主:why168

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo