Windows 32位 API Windows 基本类型(转)
' ------------------------------------------------------------------------
'
' WIN32API.TXT -- Win32 API Declarations for Visual Basic
'
' Copyright (C) 1994-98 Microsoft Corporation
'
' This file is required for the Visual Basic 6.0 version of the APILoader.
' Older versions of this file will not work correctly with the version
' 6.0 APILoader. This file is backwards compatible with previous releases
' of the APILoader with the exception that Constants are no longer declared
' as Global or Public in this file.
'
' This file contains only the Const, Type,
' and Declare statements for Win32 APIs.
'
' You have a royalty-free right to use, modify, reproduce and distribute
' this file (and/or any modified version) in any way you find useful,
' provided that you agree that Microsoft has no warranty, obligation or
' liability for its contents. Refer to the Microsoft Windows Programmer's
' Reference for further information.
'
' ------------------------------------------------------------------------
' Type definitions for Windows' basic types.
Const ANYSIZE_ARRAY = 1
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Type RECTL
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Type POINTAPI
x As Long
y As Long
End Type
Type POINTL
x As Long
y As Long
End Type
Type Size
cx As Long
cy As Long
End Type
Type POINTS
x As Integer
y As Integer
End Type
Type MSG
hwnd As Long
message As Long
wParam As Long
lParam As Long
time As Long
pt As POINTAPI
End Type
Const DELETE = &H10000
Const READ_CONTROL = &H20000
Const WRITE_DAC = &H40000
Const WRITE_OWNER = &H80000
Const SYNCHRONIZE = &H100000
Const STANDARD_RIGHTS_READ = (READ_CONTROL)
Const STANDARD_RIGHTS_WRITE = (READ_CONTROL)
Const STANDARD_RIGHTS_EXECUTE = (READ_CONTROL)
Const STANDARD_RIGHTS_REQUIRED = &HF0000
Const STANDARD_RIGHTS_ALL = &H1F0000
Const SPECIFIC_RIGHTS_ALL = &HFFFF
Type SID_IDENTIFIER_AUTHORITY
Value(6) As Byte
End Type
Const SID_REVISION = (1) ' Current revision level
Const SID_MAX_SUB_AUTHORITIES = (15)
Const SID_RECOMMENDED_SUB_AUTHORITIES = (1) ' Will change to around 6 in a future release.
Const SidTypeUser = 1
Const SidTypeGroup = 2
Const SidTypeDomain = 3
Const SidTypeAlias = 4
Const SidTypeWellKnownGroup = 5
Const SidTypeDeletedAccount = 6
Const SidTypeInvalid = 7
Const SidTypeUnknown = 8
Type SID_AND_ATTRIBUTES
Sid As Long
Attributes As Long
End Type
' ///////////////////////////////////////////////////////////////////////////
' //
' Universal well-known SIDs //
' //
' Null SID S-1-0-0 //
' World S-1-1-0 //
' Local S-1-2-0 //
' Creator Owner ID S-1-3-0 //
' Creator Group ID S-1-3-1 //
' //
' (Non-unique IDs) S-1-4 //
' //
' ///////////////////////////////////////////////////////////////////////////
Const SECURITY_NULL_RID = &H0
Const SECURITY_WORLD_RID = &H0
Const SECURITY_LOCAL_RID = &H0
Const SECURITY_CREATOR_OWNER_RID = &H0
Const SECURITY_CREATOR_GROUP_RID = &H1
' ///////////////////////////////////////////////////////////////////////////
' //
' NT well-known SIDs //
' //
' NT Authority S-1-5 //
' Dialup S-1-5-1 //
' //
' Network S-1-5-2 //
' Batch S-1-5-3 //
' Interactive S-1-5-4 //
' Service S-1-5-6 //
' AnonymousLogon S-1-5-7 (aka null logon session) //
' //
' (Logon IDs) S-1-5-5-X-Y //
' //
' (NT non-unique IDs) S-1-5-0x15-... //
' //
' (Built-in domain) s-1-5-0x20 //
' //
' ///////////////////////////////////////////////////////////////////////////
Const SECURITY_DIALUP_RID = &H1
Const SECURITY_NETWORK_RID = &H2
Const SECURITY_BATCH_RID = &H3
Const SECURITY_INTERACTIVE_RID = &H4
Const SECURITY_SERVICE_RID = &H6
Const SECURITY_ANONYMOUS_LOGON_RID = &H7
Const SECURITY_LOGON_IDS_RID = &H5
Const SECURITY_LOCAL_SYSTEM_RID = &H12
Const SECURITY_NT_NON_UNIQUE = &H15
Const SECURITY_BUILTIN_DOMAIN_RID = &H20
' ///////////////////////////////////////////////////////////////////////////
' //
' well-known domain relative sub-authority values (RIDs)... //
' //
' ///////////////////////////////////////////////////////////////////////////
Const DOMAIN_USER_RID_ADMIN = &H1F4
Const DOMAIN_USER_RID_GUEST = &H1F5
Const DOMAIN_GROUP_RID_ADMINS = &H200
Const DOMAIN_GROUP_RID_USERS = &H201
Const DOMAIN_GROUP_RID_GUESTS = &H202
Const DOMAIN_ALIAS_RID_ADMINS = &H220
Const DOMAIN_ALIAS_RID_USERS = &H221
Const DOMAIN_ALIAS_RID_GUESTS = &H222
Const DOMAIN_ALIAS_RID_POWER_USERS = &H223
Const DOMAIN_ALIAS_RID_ACCOUNT_OPS = &H224
Const DOMAIN_ALIAS_RID_SYSTEM_OPS = &H225
Const DOMAIN_ALIAS_RID_PRINT_OPS = &H226
Const DOMAIN_ALIAS_RID_BACKUP_OPS = &H227
Const DOMAIN_ALIAS_RID_REPLICATOR = &H228
' Allocate the System Luid. The first 1000 LUIDs are reserved.
' Use #999 here0x3E7 = 999)
' end_ntifs
' //////////////////////////////////////////////////////////////////////
' //
' User and Group related SID attributes //
' //
' //////////////////////////////////////////////////////////////////////
' Group attributes
Const SE_GROUP_MANDATORY = &H1
Const SE_GROUP_ENABLED_BY_DEFAULT = &H2
Const SE_GROUP_ENABLED = &H4
Const SE_GROUP_OWNER = &H8
Const SE_GROUP_LOGON_ID = &HC0000000
' User attributes
' (None yet defined.)
' ----------------
' Kernel Section
' ----------------
Const FILE_BEGIN = 0
Const FILE_CURRENT = 1
Const FILE_END = 2
Const FILE_FLAG_WRITE_THROUGH = &H80000000
Const FILE_FLAG_OVERLAPPED = &H40000000
Const FILE_FLAG_NO_BUFFERING = &H20000000
Const FILE_FLAG_RANDOM_ACCESS = &H10000000
Const FILE_FLAG_SEQUENTIAL_SCAN = &H8000000
Const FILE_FLAG_DELETE_ON_CLOSE = &H4000000
Const FILE_FLAG_BACKUP_SEMANTICS = &H2000000
Const FILE_FLAG_POSIX_SEMANTICS = &H1000000
Const CREATE_NEW = 1
Const CREATE_ALWAYS = 2
Const OPEN_EXISTING = 3
Const OPEN_ALWAYS = 4
Const TRUNCATE_EXISTING = 5
' Define the dwOpenMode values for CreateNamedPipe
Const PIPE_ACCESS_INBOUND = &H1
Const PIPE_ACCESS_OUTBOUND = &H2
Const PIPE_ACCESS_DUPLEX = &H3
' Define the Named Pipe End flags for GetNamedPipeInfo
Const PIPE_CLIENT_END = &H0
Const PIPE_SERVER_END = &H1
' Define the dwPipeMode values for CreateNamedPipe
Const PIPE_WAIT = &H0
Const PIPE_NOWAIT = &H1
Const PIPE_READMODE_BYTE = &H0
Const PIPE_READMODE_MESSAGE = &H2
Const PIPE_TYPE_BYTE = &H0
Const PIPE_TYPE_MESSAGE = &H4
' Define the well known values for CreateNamedPipe nMaxInstances
Const PIPE_UNLIMITED_INSTANCES = 255
' Define the Security Quality of Service bits to be passed
' into CreateFile
Const SECURITY_CONTEXT_TRACKING = &H40000
Const SECURITY_EFFECTIVE_ONLY = &H80000
Const SECURITY_SQOS_PRESENT = &H100000
Const SECURITY_VALID_SQOS_FLAGS = &H1F0000
Type OVERLAPPED
Internal As Long
InternalHigh As Long
offset As Long
OffsetHigh As Long
hEvent As Long
End Type
Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type
Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessId As Long
dwThreadId As Long
End Type
Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
' Serial provider type.
Const SP_SERIALCOMM = &H1&
' Provider SubTypes
Const PST_UNSPECIFIED = &H0&
Const PST_RS232 = &H1&
Const PST_PARALLELPORT = &H2&
Const PST_RS422 = &H3&
Const PST_RS423 = &H4&
Const PST_RS449 = &H5&
Const PST_FAX = &H21&
Const PST_SCANNER = &H22&
Const PST_NETWORK_BRIDGE = &H100&
Const PST_LAT = &H101&
Const PST_TCPIP_TELNET = &H102&
Const PST_X25 = &H103&
' Provider capabilities flags.
Const PCF_DTRDSR = &H1&
Const PCF_RTSCTS = &H2&
Const PCF_RLSD = &H4&
Const PCF_PARITY_CHECK = &H8&
Const PCF_XONXOFF = &H10&
Const PCF_SETXCHAR = &H20&
Const PCF_TOTALTIMEOUTS = &H40&
Const PCF_INTTIMEOUTS = &H80&
Const PCF_SPECIALCHARS = &H100&
Const PCF_16BITMODE = &H200&
' Comm provider settable parameters.
Const SP_PARITY = &H1&
Const SP_BAUD = &H2&
Const SP_DATABITS = &H4&
Const SP_STOPBITS = &H8&
Const SP_HANDSHAKING = &H10&
Const SP_PARITY_CHECK = &H20&
Const SP_RLSD = &H40&
' Settable baud rates in the provider.
Const BAUD_075 = &H1&
Const BAUD_110 = &H2&
Const BAUD_134_5 = &H4&
Const BAUD_150 = &H8&
Const BAUD_300 = &H10&
Const BAUD_600 = &H20&
Const BAUD_1200 = &H40&
Const BAUD_1800 = &H80&
Const BAUD_2400 = &H100&
Const BAUD_4800 = &H200&
Const BAUD_7200 = &H400&
Const BAUD_9600 = &H800&
Const BAUD_14400 = &H1000&
Const BAUD_19200 = &H2000&
Const BAUD_38400 = &H4000&
Const BAUD_56K = &H8000&
Const BAUD_128K = &H10000
Const BAUD_115200 = &H20000
Const BAUD_57600 = &H40000
Const BAUD_USER = &H10000000
' Settable Data Bits
Const DATABITS_5 = &H1&
Const DATABITS_6 = &H2&
Const DATABITS_7 = &H4&
Const DATABITS_8 = &H8&
Const DATABITS_16 = &H10&
Const DATABITS_16X = &H20&
' Settable Stop and Parity bits.
Const STOPBITS_10 = &H1&
Const STOPBITS_15 = &H2&
Const STOPBITS_20 = &H4&
Const PARITY_NONE = &H100&
Const PARITY_ODD = &H200&
Const PARITY_EVEN = &H400&
Const PARITY_MARK = &H800&
Const PARITY_SPACE = &H1000&
Type COMMPROP
wPacketLength As Integer
wPacketVersion As Integer
dwServiceMask As Long
dwReserved1 As Long
dwMaxTxQueue As Long
dwMaxRxQueue As Long
dwMaxBaud As Long
dwProvSubType As Long
dwProvCapabilities As Long
dwSettableParams As Long
dwSettableBaud As Long
wSettableData As Integer
wSettableStopParity As Integer
dwCurrentTxQueue As Long
dwCurrentRxQueue As Long
dwProvSpec1 As Long
dwProvSpec2 As Long
wcProvChar(1) As Integer
End Type
'Type COMSTAT
' fCtsHold As Long
' fDsrHold As Long
' fRlsdHold As Long
' fXoffHold As Long
' fXoffSent As Long
' fEof As Long
' fTxim As Long
' fReserved As Long
' cbInQue As Long
' cbOutQue As Long
'End Type
Type COMSTAT
fBitFields As Long 'See Comment in Win32API.Txt
cbInQue As Long
cbOutQue As Long
End Type
' The eight actual COMSTAT bit-sized data fields within the four bytes of fBitFields can be manipulated by bitwise logical And/Or operations.
' FieldName Bit # Description
' --------- ----- ---------------------------
' fCtsHold 1 Tx waiting for CTS signal
' fDsrHold 2 Tx waiting for DSR signal
' fRlsdHold 3 Tx waiting for RLSD signal
' fXoffHold 4 Tx waiting, XOFF char rec'd
' fXoffSent 5 Tx waiting, XOFF char sent
' fEof 6 EOF character sent
' fTxim 7 character waiting for Tx
' fReserved 8 reserved (25 bits)
' DTR Control Flow Values.
Const DTR_CONTROL_DISABLE = &H0
Const DTR_CONTROL_ENABLE = &H1
Const DTR_CONTROL_HANDSHAKE = &H2
' RTS Control Flow Values
Const RTS_CONTROL_DISABLE = &H0
Const RTS_CONTROL_ENABLE = &H1
Const RTS_CONTROL_HANDSHAKE = &H2
Const RTS_CONTROL_TOGGLE = &H3
'Type DCB
' DCBlength As Long
' BaudRate As Long
' fBinary As Long
' fParity As Long
' fOutxCtsFlow As Long
' fOutxDsrFlow As Long
' fDtrControl As Long
' fDsrSensitivity As Long
' fTXContinueOnXoff As Long
' fOutX As Long
' fInX As Long
' fErrorChar As Long
' fNull As Long
' fRtsControl As Long
' fAbortOnError As Long
' fDummy2 As Long
' wReserved As Integer
' XonLim As Integer
' XoffLim As Integer
' ByteSize As Byte
' Parity As Byte
' StopBits As Byte
' XonChar As Byte
' XoffChar As Byte
' ErrorChar As Byte
' EofChar As Byte
' EvtChar As Byte
'End Type
Type DCB
DCBlength As Long
BaudRate As Long
fBitFields As Long 'See Comments in Win32API.Txt
wReserved As Integer
XonLim As Integer
XoffLim As Integer
ByteSize As Byte
Parity As Byte
StopBits As Byte
XonChar As Byte
XoffChar As Byte
ErrorChar As Byte
EofChar As Byte
EvtChar As Byte
wReserved1 As Integer 'Reserved; Do Not Use
End Type
' The fourteen actual DCB bit-sized data fields within the four bytes of fBitFields can be manipulated by bitwise logical And/Or operations.
' FieldName Bit # Description
' ----------------- ----- ------------------------------
' fBinary 1 binary mode, no EOF check
' fParity 2 enable parity checking
' fOutxCtsFlow 3 CTS output flow control
' fOutxDsrFlow 4 DSR output flow control
' fDtrControl 5 DTR flow control type (2 bits)
' fDsrSensitivity 7 DSR sensitivity
' fTXContinueOnXoff 8 XOFF continues Tx
' fOutX 9 XON/XOFF out flow control
' fInX 10 XON/XOFF in flow control
' fErrorChar 11 enable error replacement
' fNull 12 enable null stripping
' fRtsControl 13 RTS flow control (2 bits)
' fAbortOnError 15 abort reads/writes on error
' fDummy2 16 reserved
Type COMMTIMEOUTS
ReadIntervalTimeout As Long
ReadTotalTimeoutMultiplier As Long
ReadTotalTimeoutConstant As Long
WriteTotalTimeoutMultiplier As Long
WriteTotalTimeoutConstant As Long
End Type
Type SYSTEM_INFO
dwOemID As Long
dwPageSize As Long
lpMinimumApplicationAddress As Long
lpMaximumApplicationAddress As Long
dwActiveProcessorMask As Long
dwNumberOrfProcessors As Long
dwProcessorType As Long
dwAllocationGranularity As Long
dwReserved As Long
End Type
' Global Memory Flags
Const GMEM_FIXED = &H0
Const GMEM_MOVEABLE = &H2
Const GMEM_NOCOMPACT = &H10
Const GMEM_NODISCARD = &H20
Const GMEM_ZEROINIT = &H40
Const GMEM_MODIFY = &H80
Const GMEM_DISCARDABLE = &H100
Const GMEM_NOT_BANKED = &H1000
Const GMEM_SHARE = &H2000
Const GMEM_DDESHARE = &H2000
Const GMEM_NOTIFY = &H4000
Const GMEM_LOWER = GMEM_NOT_BANKED
Const GMEM_VALID_FLAGS = &H7F72
Const GMEM_INVALID_HANDLE = &H8000
Const GHND = (GMEM_MOVEABLE Or GMEM_ZEROINIT)
Const GPTR = (GMEM_FIXED Or GMEM_ZEROINIT)
' Flags returned by GlobalFlags (in addition to GMEM_DISCARDABLE)
Const GMEM_DISCARDED = &H4000
Const GMEM_LOCKCOUNT = &HFF
Type MEMORYSTATUS
dwLength As Long
dwMemoryLoad As Long
dwTotalPhys As Long
dwAvailPhys As Long
dwTotalPageFile As Long
dwAvailPageFile As Long
dwTotalVirtual As Long
dwAvailVirtual As Long
End Type
' Local Memory Flags
Const LMEM_FIXED = &H0
Const LMEM_MOVEABLE = &H2
Const LMEM_NOCOMPACT = &H10
Const LMEM_NODISCARD = &H20
Const LMEM_ZEROINIT = &H40
Const LMEM_MODIFY = &H80
Const LMEM_DISCARDABLE = &HF00
Const LMEM_VALID_FLAGS = &HF72
Const LMEM_INVALID_HANDLE = &H8000
Const LHND = (LMEM_MOVEABLE + LMEM_ZEROINIT)
Const LPTR = (LMEM_FIXED + LMEM_ZEROINIT)
Const NONZEROLHND = (LMEM_MOVEABLE)
Const NONZEROLPTR = (LMEM_FIXED)
' Flags returned by LocalFlags (in addition to LMEM_DISCARDABLE)
Const LMEM_DISCARDED = &H4000
Const LMEM_LOCKCOUNT = &HFF
' dwCreationFlag values
Const DEBUG_PROCESS = &H1
Const DEBUG_ONLY_THIS_PROCESS = &H2
Const CREATE_SUSPENDED = &H4
Const DETACHED_PROCESS = &H8
Const CREATE_NEW_CONSOLE = &H10
Const NORMAL_PRIORITY_CLASS = &H20
Const IDLE_PRIORITY_CLASS = &H40
Const HIGH_PRIORITY_CLASS = &H80
Const REALTIME_PRIORITY_CLASS = &H100
Const CREATE_NEW_PROCESS_GROUP = &H200
Const CREATE_NO_WINDOW = &H8000000
Const PROFILE_USER = &H10000000
Const PROFILE_KERNEL = &H20000000
Const PROFILE_SERVER = &H40000000
Const MAXLONG = &H7FFFFFFF
Const THREAD_BASE_PRIORITY_MIN = -2
Const THREAD_BASE_PRIORITY_MAX = 2
Const THREAD_BASE_PRIORITY_LOWRT = 15
Const THREAD_BASE_PRIORITY_IDLE = -15
Const THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN
Const THREAD_PRIORITY_BELOW_NORMAL = (THREAD_PRIORITY_LOWEST + 1)
Const THREAD_PRIORITY_NORMAL = 0
Const THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX
Const THREAD_PRIORITY_ABOVE_NORMAL = (THREAD_PRIORITY_HIGHEST - 1)
Const THREAD_PRIORITY_ERROR_RETURN = (MAXLONG)
Const THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT
Const THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE
原帖来自于网易社区:http://club.163.com/viewArticleByWWW.m?boardId=vbnbasic&articleId=vbnbasic_110d3010cce21ae_1