【分享成果,随喜正能量】不要去要求别人理解你、共情你、尊重你。这是弱者的思维。强者不会这样做。 所谓强者,就是能承受更多压力,能接受更多不公,能忍受更多委屈。不怕被利用,就怕你没用。 。跟我学VBA,我这里专注VBA, 授人以渔。我98年开始,从源码接触VBA已经20余年了,随着年龄的增长,越来越觉得有必要把这项技能传递给需要这项技术的职场人员。希望职场和数据打交道的朋友,都来学习VBA,利用VBA,起码可以提高自己的工作效率,可以有时间多陪陪父母,多陪陪家人,何乐而不为呢?这讲我们继续学习64位Office API声明语句第94讲,这些内容是MS的权威资料,看似枯燥,但对于想学习API函数的朋友是非常有用的。当学员学习到高级阶段,如果引用API,这个资料可以直接查到64位写法。大多数情况下我们是将低版本的程序文件升级到高版本,这时您就不必为如下的错误提示所困扰了: ' timer error return valuesConst TIMERR_NOERROR = (0) ' no errorConst TIMERR_NOCANDO = (TIMERR_BASE + 1) ' request not completedConst TIMERR_STRUCT = (TIMERR_BASE + 33) ' time struct size ' flags for wFlags parameter of timeSetEvent() functionConst TIME_ONESHOT = 0 ' program timer for single eventConst TIME_PERIODIC = 1 ' program for continuous periodic event Type TIMECAPS wPeriodMin As Long wPeriodMax As LongEnd Type Declare PtrSafe Function timeGetSystemTime Lib "winmm.dll" Alias "timeGetSystemTime" (lpTime As MMTIME, ByVal uSize As Long) As LongDeclare PtrSafe Function timeGetTime Lib "winmm.dll" Alias "timeGetTime" () As LongDeclare PtrSafe Function timeSetEvent Lib "winmm.dll" Alias "timeSetEvent" (ByVal uDelay As Long, ByVal uResolution As Long, ByVal lpFunction As LongPtr, ByVal dwUser As LongPtr, ByVal uFlags As Long) As LongDeclare PtrSafe Function timeKillEvent Lib "winmm.dll" Alias "timeKillEvent" (ByVal uID As Long) As LongDeclare PtrSafe Function timeGetDevCaps Lib "winmm.dll" Alias "timeGetDevCaps" (lpTimeCaps As TIMECAPS, ByVal uSize As Long) As LongDeclare PtrSafe Function timeBeginPeriod Lib "winmm.dll" Alias "timeBeginPeriod" (ByVal uPeriod As Long) As LongDeclare PtrSafe Function timeEndPeriod Lib "winmm.dll" Alias "timeEndPeriod" (ByVal uPeriod As Long) As Long ' joystick error return valuesConst JOYERR_NOERROR = (0) ' no errorConst JOYERR_PARMS = (JOYERR_BASE + 5) ' bad parametersConst JOYERR_NOCANDO = (JOYERR_BASE + 6) ' request not completedConst JOYERR_UNPLUGGED = (JOYERR_BASE + 7) ' joystick is unplugged ' constants used with JOYINFO structure and MM_JOY messagesConst JOY_BUTTON1 = &H1Const JOY_BUTTON2 = &H2Const JOY_BUTTON3 = &H4Const JOY_BUTTON4 = &H8Const JOY_BUTTON1CHG = &H100Const JOY_BUTTON2CHG = &H200Const JOY_BUTTON3CHG = &H400Const JOY_BUTTON4CHG = &H800 ' joystick ID constantsConst JOYSTICKID1 = 0Const JOYSTICKID2 = 1 Type JOYCAPS wMid As Integer wPid As Integer szPname(0 To MAXPNAMELEN - 1) As Byte wXmin As Long wXmax As Long wYmin As Long wYmax As Long wZmin As Long wZmax As Long wNumButtons As Long wPeriodMin As Long wPeriodMax As Long'#if (WINVER >= 0x0400) wRmin As Long wRmax As Long wUmin As Long wUmax As Long wVmin As Long wVmax As Long wCaps As Long wMaxAxes As Long wNumAxes As Long wMaxButtons As Long szRegKey(0 To MAXPNAMELEN - 1) As Byte szOEMVxD(0 To MAX_JOYSTICKOEMVXDNAME - 1) As Byte'#endifEnd Type Declare PtrSafe Function joyGetDevCaps Lib "winmm.dll" Alias "joyGetDevCapsA" (ByVal id As LongPtr, lpCaps As JOYCAPS, ByVal uSize As Long) As Long Declare PtrSafe Function joyGetNumDevs Lib "winmm.dll" Alias "joyGetNumDev" () As LongDeclare PtrSafe Function joyGetThreshold Lib "winmm.dll" Alias "joyGetThreshold" (ByVal id As Long, lpuThreshold As Long) As LongDeclare PtrSafe Function joyReleaseCapture Lib "winmm.dll" Alias "joyReleaseCapture" (ByVal id As Long) As LongDeclare PtrSafe Function joySetCapture Lib "winmm.dll" Alias "joySetCapture" (ByVal hwnd As LongPtr, ByVal uID As Long, ByVal uPeriod As Long, ByVal bChanged As Long) As LongDeclare PtrSafe Function joySetThreshold Lib "winmm.dll" Alias "joySetThreshold" (ByVal id As Long, ByVal uThreshold As Long) As Long ' MMIO error return valuesConst MMIOERR_BASE = 256Const MMIOERR_FILENOTFOUND = (MMIOERR_BASE + 1) ' file not foundConst MMIOERR_OUTOFMEMORY = (MMIOERR_BASE + 2) ' out of memoryConst MMIOERR_CANNOTOPEN = (MMIOERR_BASE + 3) ' cannot openConst MMIOERR_CANNOTCLOSE = (MMIOERR_BASE + 4) ' cannot closeConst MMIOERR_CANNOTREAD = (MMIOERR_BASE + 5) ' cannot readConst MMIOERR_CANNOTWRITE = (MMIOERR_BASE + 6) ' cannot writeConst MMIOERR_CANNOTSEEK = (MMIOERR_BASE + 7) ' cannot seekConst MMIOERR_CANNOTEXPAND = (MMIOERR_BASE + 8) ' cannot expand fileConst MMIOERR_CHUNKNOTFOUND = (MMIOERR_BASE + 9) ' chunk not foundConst MMIOERR_UNBUFFERED = (MMIOERR_BASE + 10) ' file is unbuffered ' MMIO constantsConst CFSEPCHAR = "+" ' compound file name separator char. Type MMIOINFO dwFlags As Long fccIOProc As Long pIOProc As LongPtr wErrorRet As Long htask As LongPtr cchBuffer As Long pchBuffer As String pchNext As String pchEndRead As String pchEndWrite As String lBufOffset As Long lDiskOffset As Long adwInfo(0 To 2) As Long dwReserved1 As Long dwReserved2 As Long hmmio As LongPtrEnd Type Const MMIO_RWMODE = &H3 ' mask to get bits used for opening ' file for reading/writing/bothConst MMIO_SHAREMODE = &H70 ' file sharing mode number ' constants for dwFlags field of MMIOINFOConst MMIO_CREATE = &H1000 ' create new file (or truncate file)Const MMIO_PARSE = &H100 ' parse new file returning pathConst MMIO_DELETE = &H200 ' create new file (or truncate file)Const MMIO_EXIST = &H4000 ' checks for existence of fileConst MMIO_ALLOCBUF = &H10000 ' mmioOpen() should allocate a bufferConst MMIO_GETTEMP = &H20000 ' mmioOpen() should retrieve temp name Const MMIO_DIRTY = &H10000000 ' I/O buffer is dirty' MMIO_DIRTY is also used in thefield of MMCKINFO structure Const MMIO_OPEN_VALID = &H3FFFF ' valid flags for mmioOpen ;Internal ' read/write mode numbers (bit field MMIO_RWMODE)Const MMIO_READ = &H0 ' open file for reading onlyConst MMIO_WRITE = &H1 ' open file for writing onlyConst MMIO_READWRITE = &H2 ' open file for reading and writing ' share mode numbers (bit field MMIO_SHAREMODE)Const MMIO_COMPAT = &H0 ' compatibility modeConst MMIO_EXCLUSIVE = &H10 ' exclusive-access modeConst MMIO_DENYWRITE = &H20 ' deny writing to other processesConst MMIO_DENYREAD = &H30 ' deny reading to other processesConst MMIO_DENYNONE = &H40 ' deny nothing to other processes ' flags for other functionsConst MMIO_FHOPEN = &H10 ' mmioClose(): keep file handle openConst MMIO_EMPTYBUF = &H10 ' mmioFlush(): empty the I/O bufferConst MMIO_TOUPPER = &H10 ' mmioStringToFOURCC(): cvt. to u-caseConst MMIO_INSTALLPROC = &H10000 ' mmioInstallIOProc(): install MMIOProcConst MMIO_PUBLICPROC = &H10000000 ' mmioInstallIOProc: install GloballyConst MMIO_UNICODEPROC = &H1000000 ' mmioInstallIOProc(): Unicode MMIOProcConst MMIO_REMOVEPROC = &H20000 ' mmioInstallIOProc(): remove MMIOProcConst MMIO_FINDPROC = &H40000 ' mmioInstallIOProc(): find an MMIOProcConst MMIO_FINDCHUNK = &H10 ' mmioDescend(): find a chunk by IDConst MMIO_FINDRIFF = &H20 ' mmioDescend(): find a LIST chunkConst MMIO_FINDLIST = &H40 ' mmioDescend(): find a RIFF chunkConst MMIO_CREATERIFF = &H20 ' mmioCreateChunk(): make a LIST chunkConst MMIO_CREATELIST = &H40 ' mmioCreateChunk(): make a RIFF chunk Const MMIO_VALIDPROC = &H11070000 ' valid for mmioInstallIOProc ;Internal ' message numbers for MMIOPROC I/O procedure functionsConst MMIOM_READ = MMIO_READ ' read (must equal MMIO_READ!)Const MMIOM_WRITE = MMIO_WRITE ' write (must equal MMIO_WRITE!)Const MMIOM_SEEK = 2 ' seek to a new position in fileConst MMIOM_OPEN = 3 ' open fileConst MMIOM_CLOSE = 4 ' close fileConst MMIOM_WRITEFLUSH = 5 ' write and flushConst MMIOM_RENAME = 6 ' rename specified fileConst MMIOM_USER = &H8000& ' beginning of user-defined messages ' flags for mmioSeek()Const SEEK_SET = 0 ' seek to an absolute positionConst SEEK_CUR = 1 ' seek relative to current positionConst SEEK_END = 2 ' seek relative to end of file ' other constantsConst MMIO_DEFAULTBUFFER = 8192 ' default buffer size Type MMCKINFO ckid As Long ckSize As Long fccType As Long dwDataOffset As Long dwFlags As LongEnd Type Declare PtrSafe Function mmioStringToFOURCC Lib "winmm.dll" Alias "mmioStringToFOURCCA" (ByVal sz As String, ByVal uFlags As Long) As Long Declare PtrSafe Function mmioOpen Lib "winmm.dll" Alias "mmioOpenA" (ByVal szFileName As String, lpmmioinfo As MMIOINFO, ByVal dwOpenFlags As Long) As LongPtr Declare PtrSafe Function mmioRename Lib "winmm.dll" Alias "mmioRenameA" (ByVal szFileName As String, ByVal SzNewFileName As String, lpmmioinfo As MMIOINFO, ByVal dwRenameFlags As Long) As Long Declare PtrSafe Function mmioClose Lib "winmm.dll" Alias "mmioClose" (ByVal hmmio As LongPtr, ByVal uFlags As Long) As LongDeclare PtrSafe Function mmioRead Lib "winmm.dll" Alias "mmioRead" (ByVal hmmio As LongPtr, ByVal pch As String, ByVal cch As Long) As LongDeclare PtrSafe Function mmioWrite Lib "winmm.dll" Alias "mmioWrite" (ByVal hmmio As LongPtr, ByVal pch As String, ByVal cch As Long) As LongDeclare PtrSafe Function mmioSeek Lib "winmm.dll" Alias "mmioSeek" (ByVal hmmio As LongPtr, ByVal lOffset As Long, ByVal iOrigin As Long) As Long 我20多年的VBA实践经验,全部浓缩在下面的各个教程中: 【分享成果,随喜正能量】非黑即白,非左即右,非朋友即敌人,非圣人即恶棍,是很幼稚而危险的思维,一定要警惕。 这个时代的最大好处是,你可以跟志趣相投的人聚集,远离三观迥异的人。你一定要跟后者纠缠,是你的问题。保持情绪稳定。坚持做正确的事,然后交给时间。 。