Develop and Download Open Source Software

Browse Subversion Repository

Contents of /NeoFT/Win32Util/Keyboard.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations) (download)
Tue Mar 25 12:06:05 2008 UTC (16 years ago) by c477
File size: 770 byte(s)


1 using System;
2 using System.Runtime.InteropServices;
3
4 namespace nft.win32util
5 {
6 /// <summary>
7 /// Keyboard-related utility functions
8 /// </summary>
9 public class Keyboard
10 {
11 [DllImport("User32.dll")]
12 private static extern short GetAsyncKeyState( int vKey );
13
14 // virtual key code (see Platform SDK)
15 private const int VK_LEFT = 0x25;
16 private const int VK_UP = 0x26;
17 private const int VK_RIGHT = 0x27;
18 private const int VK_DOWN = 0x28;
19 private const int VK_SHIFT = 0x10;
20 private const int VK_CONTROL = 0x11;
21
22 public static bool isShiftKeyPressed {
23 get {
24 return GetAsyncKeyState(VK_SHIFT)<0;
25 }
26 }
27
28 public static bool isControlKeyPressed {
29 get {
30 return GetAsyncKeyState(VK_CONTROL)<0;
31 }
32 }
33 }
34 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26