VC++编程100个实用实例源码

源代码在线查看: event.h

软件大小: 2578 K
上传用户: forchwei
关键词: 100 VC 编程 源码
下载地址: 免注册下载 普通下载 VIP

相关代码

				//File Event.h
				
				#include 
				#include "Mouse.h"
				
				#define MBUTTON 1
				#define KEYBD   2
				#define CR     13
				#define ESC    27
				#define BACKSP  8
				
				struct EventMsg
				{
					int type,mx,my,button;
					unsigned key;
				};
				
				int KeyEvent(void)
				{
					int key=bioskey(1);
					if (key)key=bioskey(0);
					return key;
				}
				
				void GetEvent(EventMsg&eventMsg)
				{
					/*while ((!mouse.Event())&&(!(eventMsg.key=KeyEvent()))){}*/
					//******************************************Corresponding The Above Line
					if((!mouse.Event())&&(!(eventMsg.key=KeyEvent()))){}
					//******************************************Corresponding The Above Line
					eventMsg.button=mouse.GetButton();
					if (eventMsg.button)
					{
						eventMsg.type=MBUTTON;
						mouse.GetXY(eventMsg.mx,eventMsg.my);
					}
					else
					{
						eventMsg.type=KEYBD;
						eventMsg.mx=-1;
						eventMsg.my=-1;
					}
				}			

相关资源