大侠们来看看啊! 小弟没则了!!!!!!!!!!!!!!!!翘首等待!!!!
我自己用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




