3.3 Using the Input Core
来源:互联网 发布:android 直播sdk 知乎 编辑:程序博客网 时间:2024/05/23 14:24
3.3 Using the Input Core
使用Input Core是非常简单的,只需实例化一个cInput类对象,并列出你想使用的设备的cInputDevice对象,并初始化他们就可是开用了。比如,你说你想使用两个设备,键盘和鼠标:
cInput g_Input; // 全局声明 cInputDevice g_Keyboard; cInputDevice g_Mouse; //初始化输入系统(必须的) // 如果 hWnd 和 hInst 已经被初始化过了 // hWnd = window handle, hInst = instance handle g_Input.Init(hWnd, hInst); // 创建键盘和鼠标设备 // 使用DirectInput 读取鼠标的方法 g_Keyboard.Create(&g_Input, KEYBOARD); g_Mouse.Create(&g_Input, MOUSE, FALSE); // 读取设备当前状态 g_Keyboard.Read(); g_Mouse.Read(); // 如果按下 ESC ,显示一条消息 if(g_Keyboard.GetKeyState(KEY_ESC) == TRUE) { // 要转载Esc键,所以之前用户必须先释放它 // 如果它可以再次被读取 g_Keyboard.SetLock(KEY_ESC, TRUE); MessageBox(hWnd, “ESCAPE”, “Key Pressed!”, MB_OK); } // 如果按下鼠标左键,显示坐标 if(g_Mouse.GetPureButtonState(MOUSE_LBUTTON) == TRUE) { char b[200]; sprintf(b, “%ld, %ld”, g_Mouse.GetXPos(), g_Mouse.GetYPos()); MessageBox(hWnd, b, “Mouse Coordinates”, MB_OK); } // 释放所有 g_Mouse.Free(); g_Keyboard.Free(); g_Input.Shutdown(); |
- 3.3 Using the Input Core
- Using the Input Subsystem
- 3 The Input Core(输入)
- Using ODBC in the core
- Using the Input Subsystem, Part II
- Using the Input Subsystem, Part II
- Using the Input Subsystem, Part II
- Using the Input Subsystem, Part II
- The method using the Chinese input method in Fedora 16
- 翻译(Using the cApplication Core Object:(使用cApplication对象))
- Redirecting Standard Input/Output using the Process Class
- Using the High-Level Input and Output Functions
- input core input.c (1)
- org.eclipse.core.runtime.CoreException: The Class File Viewer cannot handle the given input ('org.ec
- Using the Java APIs for Bluetooth, Part 2 - Putting the Core APIs to Work
- CodeIgniter core/input.php
- Input Core 初探
- Using Keyboard Input
- Oracle的操作符优化技术初步
- 探寻软件的永恒之道
- 图片内存占用计算
- 4.初始化与清理
- 更改sql server数据库所有者的对象
- 3.3 Using the Input Core
- SQL SERVER 2000 合理地进行逆规范化设计
- Red5 简单安装指南
- 设计模式之State Pattern 状态模式。
- How to install JSDT Refactoring Plug-in ?
- 如何让SQL Server数据库自动备份并压缩
- 给出3段代码,分别是TreeView2XML、XML2TreeView和TreeView2MenuStrip。
- 摘抄来的SNMP的建议
- EIM战国时代