暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

64位Office API声明语句第95讲

VBA语言専攻 2022-09-03
79
【分享成果,随喜正能量】与其在意别人的背弃和不善,不如经营好自己的尊严和美好,永远顺从自己,清醒,独立,不与烂人烂事纠缠,不过度忧虑。。
跟我学VBA,我这里专注VBA, 授人以渔。我98年开始,从源码接触VBA已经20余年了,随着年龄的增长,越来越觉得有必要把这项技能传递给需要这项技术的职场人员。希望职场和数据打交道的朋友,都来学习VBA,利用VBA,起码可以提高自己的工作效率,可以有时间多陪陪父母,多陪陪家人,何乐而不为呢?
这讲我们继续学习64位Office API声明语句第95讲,这些内容是MS的权威资料,看似枯燥,但对于想学习API函数的朋友是非常有用的。
当学员学习到高级阶段,如果引用API,这个资料可以直接查到64位写法。大多数情况下我们是将低版本的程序文件升级到高版本,这时您就不必为如下的错误提示所困扰了:



Declare PtrSafe Function mmioGetInfo Lib "winmm.dll" Alias "mmioGetInfo" (ByVal hmmio As LongPtr, lpmmioinfo As MMIOINFO, ByVal uFlags As Long) As Long
Declare PtrSafe Function mmioSetInfo Lib "winmm.dll" Alias "mmioSetInfo" (ByVal hmmio As LongPtr, lpmmioinfo As MMIOINFO, ByVal uFlags As Long) As Long
Declare PtrSafe Function mmioSetBuffer Lib "winmm.dll" Alias "mmioSetBuffer" (ByVal hmmio As LongPtr, ByVal pchBuffer As String, ByVal cchBuffer As Long, ByVal uFlags As Long) As Long
Declare PtrSafe Function mmioFlush Lib "winmm.dll" Alias "mmioFlush" (ByVal hmmio As LongPtr, ByVal uFlags As Long) As Long
Declare PtrSafe Function mmioAdvance Lib "winmm.dll" Alias "mmioAdvance" (ByVal hmmio As LongPtr, lpmmioinfo As MMIOINFO, ByVal uFlags As Long) As Long
Declare PtrSafe Function mmioSendMessage Lib "winmm.dll" Alias "mmioSendMessage" (ByVal hmmio As LongPtr, ByVal uMsg As Long, ByVal lParam1 As LongPtr, ByVal lParam2 As LongPtr) As LongPtr

Declare PtrSafe Function mmioDescend Lib "winmm.dll" Alias "mmioDescend" (ByVal hmmio As LongPtr, lpck As MMCKINFO, lpckParent As MMCKINFO, ByVal uFlags As Long) As Long
Declare PtrSafe Function mmioAscend Lib "winmm.dll" Alias "mmioAscend" (ByVal hmmio As LongPtr, lpck As MMCKINFO, ByVal uFlags As Long) As Long
Declare PtrSafe Function mmioCreateChunk Lib "winmm.dll" Alias "mmioCreateChunk" (ByVal hmmio As LongPtr, lpck As MMCKINFO, ByVal uFlags As Long) As Long

' MCI functions

Declare PtrSafe Function mciSendCommand Lib "winmm.dll" Alias "mciSendCommandA" (ByVal wDeviceID As Long, ByVal uMessage As Long, ByVal dwParam1 As LongPtr, ByVal dwParam2 As Any) As Long

Declare PtrSafe Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As LongPtr) As Long

Declare PtrSafe Function mciGetCreatorTask Lib "winmm.dll" Alias "mciGetCreatorTask" (ByVal wDeviceID As Long) As LongPtr

Declare PtrSafe Function mciGetDeviceID Lib "winmm.dll" Alias "mciGetDeviceIDA" (ByVal lpstrName As String) As Long

Declare PtrSafe Function mciGetDeviceIDFromElementID Lib "winmm.dll" Alias "mciGetDeviceIDFromElementIDA" (ByVal dwElementID As Long, ByVal lpstrType As String) As Long

Declare PtrSafe Function mciGetErrorString Lib "winmm.dll" Alias "mciGetErrorStringA" (ByVal dwError As Long, ByVal lpstrBuffer As String, ByVal uLength As Long) As Long

Declare PtrSafe Function mciExecute Lib "winmm.dll" Alias "mciExecute" (ByVal lpstrCommand As String) As Long

'   MCI error return values
Const MCIERR_INVALID_DEVICE_ID = (MCIERR_BASE + 1)
Const MCIERR_UNRECOGNIZED_KEYWORD = (MCIERR_BASE + 3)
Const MCIERR_UNRECOGNIZED_COMMAND = (MCIERR_BASE + 5)
Const MCIERR_HARDWARE = (MCIERR_BASE + 6)
Const MCIERR_INVALID_DEVICE_NAME = (MCIERR_BASE + 7)
Const MCIERR_OUT_OF_MEMORY = (MCIERR_BASE + 8)
Const MCIERR_DEVICE_OPEN = (MCIERR_BASE + 9)
Const MCIERR_CANNOT_LOAD_DRIVER = (MCIERR_BASE + 10)
Const MCIERR_MISSING_COMMAND_STRING = (MCIERR_BASE + 11)
Const MCIERR_PARAM_OVERFLOW = (MCIERR_BASE + 12)
Const MCIERR_MISSING_STRING_ARGUMENT = (MCIERR_BASE + 13)
Const MCIERR_BAD_INTEGER = (MCIERR_BASE + 14)
Const MCIERR_PARSER_INTERNAL = (MCIERR_BASE + 15)
Const MCIERR_DRIVER_INTERNAL = (MCIERR_BASE + 16)
Const MCIERR_MISSING_PARAMETER = (MCIERR_BASE + 17)
Const MCIERR_UNSUPPORTED_FUNCTION = (MCIERR_BASE + 18)
Const MCIERR_FILE_NOT_FOUND = (MCIERR_BASE + 19)
Const MCIERR_DEVICE_NOT_READY = (MCIERR_BASE + 20)
Const MCIERR_INTERNAL = (MCIERR_BASE + 21)
Const MCIERR_DRIVER = (MCIERR_BASE + 22)
Const MCIERR_CANNOT_USE_ALL = (MCIERR_BASE + 23)
Const MCIERR_MULTIPLE = (MCIERR_BASE + 24)
Const MCIERR_EXTENSION_NOT_FOUND = (MCIERR_BASE + 25)
Const MCIERR_OUTOFRANGE = (MCIERR_BASE + 26)
Const MCIERR_FLAGS_NOT_COMPATIBLE = (MCIERR_BASE + 28)
Const MCIERR_FILE_NOT_SAVED = (MCIERR_BASE + 30)
Const MCIERR_DEVICE_TYPE_REQUIRED = (MCIERR_BASE + 31)
Const MCIERR_DEVICE_LOCKED = (MCIERR_BASE + 32)
Const MCIERR_DUPLICATE_ALIAS = (MCIERR_BASE + 33)
Const MCIERR_BAD_CONSTANT = (MCIERR_BASE + 34)
Const MCIERR_MUST_USE_SHAREABLE = (MCIERR_BASE + 35)
Const MCIERR_MISSING_DEVICE_NAME = (MCIERR_BASE + 36)
Const MCIERR_BAD_TIME_FORMAT = (MCIERR_BASE + 37)
Const MCIERR_NO_CLOSING_QUOTE = (MCIERR_BASE + 38)
Const MCIERR_DUPLICATE_FLAGS = (MCIERR_BASE + 39)
Const MCIERR_INVALID_FILE = (MCIERR_BASE + 40)
Const MCIERR_NULL_PARAMETER_BLOCK = (MCIERR_BASE + 41)
Const MCIERR_UNNAMED_RESOURCE = (MCIERR_BASE + 42)
Const MCIERR_NEW_REQUIRES_ALIAS = (MCIERR_BASE + 43)
Const MCIERR_NOTIFY_ON_AUTO_OPEN = (MCIERR_BASE + 44)
Const MCIERR_NO_ELEMENT_ALLOWED = (MCIERR_BASE + 45)
Const MCIERR_NONAPPLICABLE_FUNCTION = (MCIERR_BASE + 46)
Const MCIERR_ILLEGAL_FOR_AUTO_OPEN = (MCIERR_BASE + 47)
Const MCIERR_FILENAME_REQUIRED = (MCIERR_BASE + 48)
Const MCIERR_EXTRA_CHARACTERS = (MCIERR_BASE + 49)
Const MCIERR_DEVICE_NOT_INSTALLED = (MCIERR_BASE + 50)
Const MCIERR_GET_CD = (MCIERR_BASE + 51)
Const MCIERR_SET_CD = (MCIERR_BASE + 52)
Const MCIERR_SET_DRIVE = (MCIERR_BASE + 53)
Const MCIERR_DEVICE_LENGTH = (MCIERR_BASE + 54)
Const MCIERR_DEVICE_ORD_LENGTH = (MCIERR_BASE + 55)
Const MCIERR_NO_INTEGER = (MCIERR_BASE + 56)

Const MCIERR_WAVE_OUTPUTSINUSE = (MCIERR_BASE + 64)
Const MCIERR_WAVE_SETOUTPUTINUSE = (MCIERR_BASE + 65)
Const MCIERR_WAVE_INPUTSINUSE = (MCIERR_BASE + 66)
Const MCIERR_WAVE_SETINPUTINUSE = (MCIERR_BASE + 67)
Const MCIERR_WAVE_OUTPUTUNSPECIFIED = (MCIERR_BASE + 68)
Const MCIERR_WAVE_INPUTUNSPECIFIED = (MCIERR_BASE + 69)
Const MCIERR_WAVE_OUTPUTSUNSUITABLE = (MCIERR_BASE + 70)
Const MCIERR_WAVE_SETOUTPUTUNSUITABLE = (MCIERR_BASE + 71)
Const MCIERR_WAVE_INPUTSUNSUITABLE = (MCIERR_BASE + 72)
Const MCIERR_WAVE_SETINPUTUNSUITABLE = (MCIERR_BASE + 73)

Const MCIERR_SEQ_DIV_INCOMPATIBLE = (MCIERR_BASE + 80)
Const MCIERR_SEQ_PORT_INUSE = (MCIERR_BASE + 81)
Const MCIERR_SEQ_PORT_NONEXISTENT = (MCIERR_BASE + 82)
Const MCIERR_SEQ_PORT_MAPNODEVICE = (MCIERR_BASE + 83)
Const MCIERR_SEQ_PORT_MISCERROR = (MCIERR_BASE + 84)
Const MCIERR_SEQ_TIMER = (MCIERR_BASE + 85)
Const MCIERR_SEQ_PORTUNSPECIFIED = (MCIERR_BASE + 86)
Const MCIERR_SEQ_NOMIDIPRESENT = (MCIERR_BASE + 87)

Const MCIERR_NO_WINDOW = (MCIERR_BASE + 90)
Const MCIERR_CREATEWINDOW = (MCIERR_BASE + 91)
Const MCIERR_FILE_READ = (MCIERR_BASE + 92)
Const MCIERR_FILE_WRITE = (MCIERR_BASE + 93)

'  All custom device driver errors must be >= this value
Const MCIERR_CUSTOM_DRIVER_BASE = (MCIERR_BASE + 256)

'  Message numbers must be in the range between MCI_FIRST and MCI_LAST

Const MCI_FIRST = &H800
'  Messages 0x801 and 0x802 are reserved
Const MCI_OPEN = &H803
Const MCI_CLOSE = &H804
Const MCI_ESCAPE = &H805
Const MCI_PLAY = &H806
Const MCI_SEEK = &H807
Const MCI_STOP = &H808
Const MCI_PAUSE = &H809
Const MCI_INFO = &H80A
Const MCI_GETDEVCAPS = &H80B
Const MCI_SPIN = &H80C
Const MCI_SET = &H80D
Const MCI_STEP = &H80E
Const MCI_RECORD = &H80F
Const MCI_SYSINFO = &H810
Const MCI_BREAK = &H811
Const MCI_SOUND = &H812
Const MCI_SAVE = &H813
Const MCI_STATUS = &H814

Const MCI_CUE = &H830

Const MCI_REALIZE = &H840
Const MCI_WINDOW = &H841
Const MCI_PUT = &H842
Const MCI_WHERE = &H843
Const MCI_FREEZE = &H844
Const MCI_UNFREEZE = &H845

Const MCI_LOAD = &H850
Const MCI_CUT = &H851
Const MCI_COPY = &H852
Const MCI_PASTE = &H853
Const MCI_UPDATE = &H854
Const MCI_RESUME = &H855
Const MCI_DELETE = &H856



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

【分享成果,随喜正能量】你只是一个平凡人,不需要给自己太多的压力。 有时候,
能把自己照顾好, 就是一种莫大的能力。。
文章转载自VBA语言専攻,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论