⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 core.cs

📁 蓝牙通讯
💻 CS
📖 第 1 页 / 共 2 页
字号:
//==========================================================================================
//
//		OpenNETCF.Win32.Core
//		Copyright (c) 2003, OpenNETCF.org
//
//		This library is free software; you can redistribute it and/or modify it under 
//		the terms of the OpenNETCF.org Shared Source License.
//
//		This library is distributed in the hope that it will be useful, but 
//		WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
//		FITNESS FOR A PARTICULAR PURPOSE. See the OpenNETCF.org Shared Source License 
//		for more details.
//
//		You should have received a copy of the OpenNETCF.org Shared Source License 
//		along with this library; if not, email licensing@opennetcf.org to request a copy.
//
//		If you wish to contact the OpenNETCF Advisory Board to discuss licensing, please 
//		email licensing@opennetcf.org.
//
//		For general enquiries, email enquiries@opennetcf.org or visit our website at:
//		http://www.opennetcf.org
//
//==========================================================================================
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Reflection;

namespace OpenNETCF.Win32
{
	
	#region Disabled public delegates
	#if!NDOC
	/* See OpenNETCF.Windows.Forms.NotifyIcon
	/// <summary>
	/// Handles notifications from Tray Icon
	/// </summary>
	public delegate bool BeforeIconMessageEventHandler(ref Message msg);
	/// <summary>
	/// Handles notifications from Tray Icon
	/// </summary>
	public delegate void AfterIconMessageEventHandler(ref Message msg);*/
	#endif
	#endregion

	/// <summary>
	/// OpenNETCF Win32 API Wrapper Class for CoreDLL.dll
	/// </summary>
	public sealed class Core
	{
		#region --------------- Library Constants and enums ---------------

		internal const uint	CLR_INVALID				= 0xFFFFFFFF;
		//public const uint	WAIT_OBJECT_0   		= 0x00000000;
		//public const uint	WAIT_ABANDONED  		= 0x00000080;
		//public const uint	WAIT_ABANDONED_0		= 0x00000080;
		//public const uint	WAIT_FAILED				= 0xffffffff;
		internal const uint	INFINITE				= 0xffffffff;
		/// <summary>
		/// The returned handle is not valid.
		/// </summary>
		public const int	INVALID_HANDLE_VALUE	= -1;
		
		#region Wait Enumeration
		/// <summary>
		/// Responses from <see cref="WaitForSingleObject"/> function.
		/// </summary>
		[CLSCompliant(false)]
		public enum Wait : uint
		{
			/// <summary>
			/// The state of the specified object is signaled.
			/// </summary>
			Object		= 0x00000000,
			/// <summary>
			/// Wait abandoned.
			/// </summary>
			Abandoned	= 0x00000080,
			/// <summary>
			/// Wait failed.
			/// </summary>
			Failed		= 0xffffffff,
		}
		#endregion

		#region Format Message Flags Enumeration
		/// <summary>
		/// Specifies aspects of the formatting process and how to interpret the lpSource parameter.
		/// </summary>
		/// <remarks>The low-order byte of dwFlags specifies how the function handles line breaks in the output buffer.
		/// The low-order byte can also specify the maximum width of a formatted output line.</remarks>
		[Flags]
		public enum FormatMessageFlags : int
		{
			/// <summary>
			/// The function allocates a buffer large enough to hold the formatted message, and places a pointer to the allocated buffer at the address specified by lpBuffer.
			/// </summary>
			AllocateBuffer = 0x00000100,
			/// <summary>
			/// Insert sequences in the message definition are to be ignored and passed through to the output buffer unchanged.
			/// </summary>
			IgnoreInserts  = 0x00000200,
			/// <summary>
			/// Specifies that lpSource is a pointer to a null-terminated message definition.
			/// </summary>
			FromString     = 0x00000400,
			/// <summary>
			/// Specifies that lpSource is a module handle containing the message-table resource(s) to search.
			/// </summary>
			FromHModule    = 0x00000800,
			/// <summary>
			/// Specifies that the function should search the system message-table resource(s) for the requested message.
			/// </summary>
			FromSystem     = 0x00001000,
			/// <summary>
			/// Specifies that the Arguments parameter is not a va_list structure, but instead is just a pointer to an array of 32-bit values that represent the arguments.
			/// </summary>
			ArgumentArray  = 0x00002000,
			/// <summary>
			/// Use the <b>MaxWidthMask</b> constant and bitwise Boolean operations to set and retrieve this maximum width value.
			/// </summary>
			MaxWidthMask  = 0x000000FF,
		}
		#endregion


		//internal const uint CF_UNICODETEXT          = 13;

		/*internal const uint NIF_MESSAGE = 0x1;
		internal const uint NIF_ICON	= 0x2;
		internal const uint NIF_TIP		= 0x4;
		internal const uint NIM_ADD		= 0;
		internal const uint NIM_DELETE  = 2;
		internal const uint NIM_MODIFY  = 1;*/
		
		/// <summary>   
		/// This message is posted when the user presses the touch-screen in the client area of a window.   
		/// </summary>      
		internal const int WM_LBUTTONDOWN	= 0x0201;
		/// <summary>   
		/// This message is used by applications to help define private messages.   
		/// </summary> 
		internal const int WM_USER			= 0x0400;

		/// <summary>
		/// 
		/// </summary>
		public const int	MK_LBUTTON		= 0x0001;
		/// <summary>
		/// 
		/// </summary>
		public const int	MK_RBUTTON		= 0x0002;
		/// <summary>
		/// 
		/// </summary>
		public const int	MK_SHIFT		= 0x0004;
		/// <summary>
		/// 
		/// </summary>
		public const int	MK_CONTROL		= 0x0008;

		internal static Int32 METHOD_BUFFERED = 0;
		internal static Int32 FILE_ANY_ACCESS = 0;
		internal static Int32 FILE_DEVICE_HAL = 0x00000101;
		internal static Int32 IOCTL_HAL_GET_DEVICEID = ((FILE_DEVICE_HAL) << 16) |
			((FILE_ANY_ACCESS) << 14) | ((21) << 2) | (METHOD_BUFFERED);

		private enum KeyEvents
		{
			ExtendedKey = 0x0001,
			KeyUp       = 0x0002,
			Silent      = 0x0004
		}

		private enum EventFlags
		{
			Pulse     = 1,
			Reset     = 2,
			Set       = 3
		}

		/// <summary>
		/// Region type
		/// </summary>
		public enum GDIRegion : int
		{
			/// <summary>
			/// 
			/// </summary>
			NULLREGION = 1,
			/// <summary>
			/// 
			/// </summary>
			SIMPLEREGION = 2,
			/// <summary>
			/// 
			/// </summary>
			COMPLEXREGION = 3
		}

		/// <summary>
		/// Background mode
		/// </summary>
		public enum BackMode : int
		{
			/// <summary>
			/// Background is Transparent.
			/// </summary>
			TRANSPARENT = 1,
			/// <summary>
			/// Background is Opaque.
			/// </summary>
			OPAQUE= 2
		}
    
		/// <summary>
		/// LocalAlloc flags
		/// </summary>
		public enum MemoryAllocFlags : int
		{
			/// <summary>   
			/// Allocates fixed memory.   
			/// The return value is a pointer to the memory object.   
			/// </summary>   
			Fixed		= 0x00,
			/// <summary>   
			/// Initializes memory contents to zero.   
			/// </summary>      
			ZeroInit	= 0x40,
			/// <summary>   
			/// Combines the Fixed and ZeroInit flags.   
			/// </summary>     
			LPtr			= ZeroInit | Fixed
		}		

		#region KeyStateFlags
		/// <summary>
		/// KeyStateFlags for Keyboard methods
		/// </summary>
		[Flags()]
		public enum KeyStateFlags : int
		{
			/// <summary>
			/// Key is toggled.
			/// </summary>
			Toggled		= 0x0001,
			/// <summary>
			/// 
			/// </summary>
			AsyncDown	= 0x0002,		//	 went down since last GetAsync call.
			/// <summary>
			/// Key was previously down.
			/// </summary>
			PrevDown	= 0x0040,
			/// <summary>
			/// Key is currently down.
			/// </summary>
			Down		= 0x0080,
			/// <summary>
			/// Left or right CTRL key is down.
			/// </summary>
			AnyCtrl		= 0x40000000,
			/// <summary>
			/// Left or right SHIFT key is down.
			/// </summary>
			AnyShift	= 0x20000000,
			/// <summary>
			/// Left or right ALT key is down.
			/// </summary>
			AnyAlt		= 0x10000000,
			/// <summary>
			/// VK_CAPITAL is toggled.
			/// </summary>
			Capital		= 0x08000000,
			/// <summary>
			/// Left CTRL key is down.
			/// </summary>
			LeftCtrl	= 0x04000000,
			/// <summary>
			/// Left SHIFT key is down.
			/// </summary>
			LeftShift	= 0x02000000,
			/// <summary>
			/// Left ALT key is down.
			/// </summary>
			LeftAlt		= 0x01000000,
			/// <summary>
			/// Left Windows logo key is down.
			/// </summary>
			LeftWin		= 0x00800000,
			/// <summary>
			/// Right CTRL key is down.
			/// </summary>
			RightCtrl	= 0x00400000,
			/// <summary>
			/// Right SHIFT key is down
			/// </summary>
			RightShift	= 0x00200000,
			/// <summary>
			/// Right ALT key is down
			/// </summary>
			RightAlt	= 0x00100000,
			/// <summary>
			/// Right Windows logo key is down.
			/// </summary>
			RightWin	= 0x00080000,
			/// <summary>
			/// Corresponding character is dead character.
			/// </summary>
			Dead		= 0x00020000,
			/// <summary>
			/// No characters in pCharacterBuffer to translate.
			/// </summary>
			NoCharacter	= 0x00010000,
			/// <summary>
			/// Use for language specific shifts.
			/// </summary>
			Language1	= 0x00008000,
			/// <summary>
			/// NumLock toggled state.
			/// </summary>
			NumLock		= 0x00001000,
		}
		#endregion

		
		

		#region WaveInCaps
		/// <summary>
		/// Class for getting audio device capabilities
		/// </summary>
		public class WaveInCaps
		{
			private const int MAXPNAMELEN = 32;
			
			private const int wMIDOffset			= 0;
			private const int wPIDOffset			= wMIDOffset + 2;
			private const int vDriverVersionOffset	= wPIDOffset + 2;
			private const int szPnameOffset			= vDriverVersionOffset + 4;
			private const int dwFormatsOffset		= szPnameOffset + MAXPNAMELEN * 2;
			private const int wChannelsOffset		= dwFormatsOffset + 4;
			private const int wReserved1Offset		= wChannelsOffset + 2;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -