OutputDebugString("hello world/n");case WM_TIMER:WINDOW api中的几种计时。
来源:互联网 发布:哪个软件有腾落指标 编辑:程序博客网 时间:2024/05/20 22:39
1.timer 来进行相应的计时。
setTimer, killTimer
利用wm_timer消息来进行相应消息的传递。
相应的时间的处理过程是函数指针(回调函数);typedef VOID (CALLBACK* TIMERPROC)(HWND, UINT, UINT, DWORD);
从而需要自定义一个相应的函数来进行处理。
void CALLBACK TimerProc1(HWND hwnd,UINT umsg,UINT iTimerId,DWORD dwTime);
当多个timer时:
SetTimer(hWnd,TIMERID1,100,TimerProc1);
SetTimer(hWnd,TIMERID2,123,TimerProcTwo);
KillTimer(hWnd,TIMERID1);
KillTimer(hWnd,TIMERID2);
相应的处理函数
void CALLBACK TimerProc1(HWND hwnd,UINT umsg,UINT iTimerId,DWORD dwTime)
{
HDC hdc;
char buf[20];
memset(buf,'/0',20);
g_Count++;
hdc = GetDC(hwnd);
itoa(g_Count,buf,10);
TextOut(hdc,10,10,buf,20);
ReleaseDC(hwnd,hdc);
return;
}
void CALLBACK TimerProcTwo(HWND hwnd,UINT msg,UINT iTimerId,DWORD dwtime)
{
OutputDebugString("hello world/n");
}
如果不利用回调函数的化可以使用wm_timer来进行处理
wparam来辨别是那个timer来进行相应的处理
case WM_TIMER:
{
switch(wParam)//-------------------------在这个地方进行相应的处理
{
case TIMERID1:
{
HDC hdc;
char buf[20];
memset(buf,'/0',20);
g_Count++;
hdc = GetDC(hWnd);
itoa(g_Count,buf,10);
TextOut(hdc,10,10,buf,20);
ReleaseDC(hWnd,hdc);
break;
}
case TIMERID2:
{
OutputDebugString("hello world/n");
break;
}
default:
break;
}
- OutputDebugString("hello world/n");case WM_TIMER:WINDOW api中的几种计时。
- “Hello world!”的N种写法
- “Hello world!”的N种写法
- “Hello World!”的N种写法
- “Hello World!”的N种写法
- “Hello world!”的N种写法
- “Hello World!”的N种写法
- “Hello World!”的N种写法
- “Hello World!”的N种写法
- “Hello World!”的N种写法
- “Hello world!”的N种写法
- “Hello world!”的N种写法
- “Hello world!”的N种写法
- “Hello world!”的N种写法
- 转:“Hello world!”的N种写法
- “Hello world!”的N种写法
- “Hello world!”的N种写法【转】
- “Hello World!”的N种写法
- 如何在快速启动栏添加显示桌面
- Concepts in Programming Languages
- The Extreme Searcher's Internet Handbook: A Guide for the Serious Searcher
- The Microsoft Data Warehouse Toolkit: With SQL Server 2005 and the Microsoft Business Intelligence T
- 数值线的动态表示
- OutputDebugString("hello world/n");case WM_TIMER:WINDOW api中的几种计时。
- XPath Essentials
- 开始学习了~
- Building Websites with VB.NET and DotNetNuke 4
- MYSQL数据库设计的一些小技巧[整理] 有感
- 原来使用 in smatnr 由于 oracle 1000 条 限制 出现问题 。。。。
- The Data Warehouse Toolkit: The Complete Guide to Dimensional Modeling (Second Edition)
- 孙正义的网络图谋
- PDC:Anders谈C# 4.0:新功能和展望