VBA 64位API声明语句第004讲

摘要:跟我学VBA,我这里专注VBA, 授人以渔。我98年开始,从源码接触VBA已经20余年了,随着年龄的增长,越来越觉得有必要把这项技能传递给需要这项技术的职场人员。希望职场和数据打交道的朋友,都来学习VBA,利用VBA,起码可以提高自己的工作效率,可以有时间多陪

跟我学VBA,我这里专注VBA, 授人以渔。我98年开始,从源码接触VBA已经20余年了,随着年龄的增长,越来越觉得有必要把这项技能传递给需要这项技术的职场人员。希望职场和数据打交道的朋友,都来学习VBA,利用VBA,起码可以提高自己的工作效率,可以有时间多陪陪父母,多陪陪家人,何乐而不为呢?我的教程一共九套,从入门开始一直讲到程序的分发,是学习利用VBA的实用教程。这份API资料是随高级教程赠送的.

这讲我们继续学习VBA 64位API声明语句第004讲,这些内容是MS的权威资料,看似枯燥,但对于想学习API函数的朋友是非常有用的。

【分享成果,随喜正能量】 放开心胸,堂堂正正,不计较眼前荣辱得失。一生做事光明磊落,心境恬然自得,自然吉祥遂愿,平安自在,乐享天年。 得此偈者,命途多舛,起起伏伏,时而阴云密布,时而朗天开。虽命途风雨阴晦,坡坎沟壑,但要堂堂正正做人,这样才能时来运转,祥光永照,天年长享。

当学员学习到高级阶段,如果引用API,这个资料可以直接查到64位写法。大多数情况下我们是将低版本的程序文件升级到高版本,这时您就不必为如下的错误提示所困扰了:

' 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

wProcessorArchitecture As Integer

wReserved As Integer

dwPageSize As Long

lpMinimumApplicationAddress As LongPtr

lpMaximumApplicationAddress As LongPtr

dwActiveProcessorMask As LongPtr

dwNumberOrfProcessors As Long

dwProcessorType As Long

dwAllocationGranularity As Long

wProcessorLevel As Integer

wProcessorRevision As Integer

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 LongPtr

dwAvailPhys As LongPtr

dwTotalPageFile As LongPtr

dwAvailPageFile As LongPtr

dwTotalVirtual As LongPtr

dwAvailVirtual As LongPtr

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

我20多年的VBA实践经验,全部浓缩在下面的各个教程中:

来源:VBA语言专业教育

相关推荐