运行结果:
源代码:
#include <windows.h>
#include <tchar.h> //使用swprintf_s函数所需的头文件
#pragma comment(lib, "winmm.lib") //调用PlaySound函数所需库文件t
#define WINDOW_WIDTH 800
#define WINDOW_HEIGHT 600
#define WINDOW_TITLE L"动画演示_计时器"
//全局设备环境句柄g_hdc与全局内存DC句柄g_mdc,并声明了位图数组g_hSprite用来储存各人物位图
HINSTANCE hInst;
HDC g_hdc;
HDC g_mdc;
HBITMAP g_hSprite[12]; //12张图片DC
int g_iNum;
int MyWindowClass(HINSTANCE);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
void MyDraw(HWND);
/*************************************************************************