跟我学VBA,我这里专注VBA, 授人以渔。我98年开始,从源码接触VBA已经20余年了,随着年龄的增长,越来越觉得有必要把这项技能传递给需要这项技术的职场人员。希望职场和数据打交道的朋友,都来学习VBA,利用VBA,起码可以提高自己的工作效率,可以有时间多陪陪父母,多陪陪家人,何乐而不为呢?我的教程一共九套,从入门开始一直讲到程序的分发,是学习利用VBA的实用教程。这份API资料是随高级教程赠送的.
这讲我们继续学习64位Office API声明语句第111讲,这些内容是MS的权威资料,看似枯燥,但对于想学习API函数的朋友是非常有用的。
【分享成果,随喜正能量】你真正要做的事情,连神明都不要讲。安静地做,成功了再说。事以密成,言以泄败,隐忍且蓄势待发。潜龙勿用,才能见龙在天而当。。
当学员学习到高级阶段,如果引用API,这个资料可以直接查到64位写法。大多数情况下我们是将低版本的程序文件升级到高版本,这时您就不必为如下的错误提示所困扰了:
Const NI_SETCANDIDATE_PAGESTART = &H16
Const NI_SETCANDIDATE_PAGESIZE = &H17
' lParam for WM_IME_SETCONTEXT
Const ISC_SHOWUICANDIDATEWINDOW = &H1
Const ISC_SHOWUICOMPOSITIONWINDOW = &H80000000
Const ISC_SHOWUIGUIDELINE = &H40000000
Const ISC_SHOWUIALLCANDIDATEWINDOW = &HF
Const ISC_SHOWUIALL = &HC000000F
' dwIndex for ImmNotifyIME/NI_COMPOSITIONSTR
Const CPS_COMPLETE = &H1
Const CPS_CONVERT = &H2
Const CPS_REVERT = &H3
Const CPS_CANCEL = &H4
' Windows for Simplified Chinese Edition hot key ID from 0x10 - 0x2F
Const IME_CHOTKEY_IME_NONIME_TOGGLE = &H10
Const IME_CHOTKEY_SHAPE_TOGGLE = &H11
Const IME_CHOTKEY_SYMBOL_TOGGLE = &H12
' Windows for Japanese Edition hot key ID from 0x30 - 0x4F
Const IME_JHOTKEY_CLOSE_OPEN = &H30
' Windows for Korean Edition hot key ID from 0x50 - 0x6F
Const IME_KHOTKEY_SHAPE_TOGGLE = &H50
Const IME_KHOTKEY_HANJACONVERT = &H51
Const IME_KHOTKEY_ENGLISH = &H52
' Windows for Tranditional Chinese Edition hot key ID from 0x70 - 0x8F
Const IME_THOTKEY_IME_NONIME_TOGGLE = &H70
Const IME_THOTKEY_SHAPE_TOGGLE = &H71
Const IME_THOTKEY_SYMBOL_TOGGLE = &H72
' direct switch hot key ID from 0x100 - 0x11F
Const IME_HOTKEY_DSWITCH_FIRST = &H100
Const IME_HOTKEY_DSWITCH_LAST = &H11F
' IME private hot key from 0x200 - 0x21F
Const IME_ITHOTKEY_RESEND_RESULTSTR = &H200
Const IME_ITHOTKEY_PREVIOUS_COMPOSITION = &H201
Const IME_ITHOTKEY_UISTYLE_TOGGLE = &H202
' parameter of ImmGetCompositionString
Const GCS_COMPREADSTR = &H1
Const GCS_COMPREADATTR = &H2
Const GCS_COMPREADCLAUSE = &H4
Const GCS_COMPSTR = &H8
Const GCS_COMPATTR = &H10
Const GCS_COMPCLAUSE = &H20
Const GCS_CURSORPOS = &H80
Const GCS_DELTASTART = &H100
Const GCS_RESULTREADSTR = &H200
Const GCS_RESULTREADCLAUSE = &H400
Const GCS_RESULTSTR = &H800
Const GCS_RESULTCLAUSE = &H1000
' style bit flags for WM_IME_COMPOSITION
Const CS_INSERTCHAR = &H2000
Const CS_NOMOVECARET = &H4000
' bits of fdwInit of INPUTCONTEXT
' IME property bits
Const IME_PROP_AT_CARET = &H10000
Const IME_PROP_SPECIAL_UI = &H20000
Const IME_PROP_CANDLIST_START_FROM_1 = &H40000
Const IME_PROP_UNICODE = &H80000
' IME UICapability bits
Const UI_CAP_2700 = &H1
Const UI_CAP_ROT90 = &H2
Const UI_CAP_ROTANY = &H4
' ImmSetCompositionString Capability bits
Const SCS_CAP_COMPSTR = &H1
Const SCS_CAP_MAKEREAD = &H2
' IME WM_IME_SELECT inheritance Capability bits
Const SELECT_CAP_CONVERSION = &H1
Const SELECT_CAP_SENTENCE = &H2
' ID for deIndex of ImmGetGuideLine
Const GGL_LEVEL = &H1
Const GGL_INDEX = &H2
Const GGL_STRING = &H3
Const GGL_PRIVATE = &H4
' ID for dwLevel of GUIDELINE Structure
Const GL_LEVEL_NOGUIDELINE = &H0
Const GL_LEVEL_FATAL = &H1
Const GL_LEVEL_ERROR = &H2
Const GL_LEVEL_WARNING = &H3
Const GL_LEVEL_INFORMATION = &H4
' ID for dwIndex of GUIDELINE Structure
Const GL_ID_UNKNOWN = &H0
Const GL_ID_NOMODULE = &H1
Const GL_ID_NODICTIONARY = &H10
Const GL_ID_CANNOTSAVE = &H11
Const GL_ID_NOCONVERT = &H20
Const GL_ID_TYPINGERROR = &H21
Const GL_ID_TOOMANYSTROKE = &H22
Const GL_ID_READINGCONFLICT = &H23
Const GL_ID_INPUTREADING = &H24
Const GL_ID_INPUTRADICAL = &H25
Const GL_ID_INPUTCODE = &H26
Const GL_ID_INPUTSYMBOL = &H27
Const GL_ID_CHOOSECANDIDATE = &H28
Const GL_ID_REVERSECONVERSION = &H29
Const GL_ID_PRIVATE_FIRST = &H8000&
Const GL_ID_PRIVATE_LAST = &HFFFF&
' ID for dwIndex of ImmGetProperty
Const IGP_PROPERTY = &H4
Const IGP_CONVERSION = &H8
Const IGP_SENTENCE = &HC
Const IGP_UI = &H10
Const IGP_SETCOMPSTR = &H14
Const IGP_SELECT = &H18
' dwIndex for ImmSetCompositionString API
Const SCS_SETSTR = (GCS_COMPREADSTR Or GCS_COMPSTR)
Const SCS_CHANGEATTR = (GCS_COMPREADATTR Or GCS_COMPATTR)
Const SCS_CHANGECLAUSE = (GCS_COMPREADCLAUSE Or GCS_COMPCLAUSE)
' attribute for COMPOSITIONSTRING Structure
Const ATTR_INPUT = &H0
Const ATTR_TARGET_CONVERTED = &H1
Const ATTR_CONVERTED = &H2
Const ATTR_TARGET_NOTCONVERTED = &H3
Const ATTR_INPUT_ERROR = &H4
' bit field for IMC_SETCOMPOSITIONWINDOW, IMC_SETCANDIDATEWINDOW
Const CFS_DEFAULT = &H0
Const CFS_RECT = &H1
Const CFS_POINT = &H2
Const CFS_SCREEN = &H4
Const CFS_FORCE_POSITION = &H20
Const CFS_CANDIDATEPOS = &H40
Const CFS_EXCLUDE = &H80
' conversion direction for ImmGetConversionList
Const GCL_CONVERSION = &H1
Const GCL_REVERSECONVERSION = &H2
Const GCL_REVERSE_LENGTH = &H3
' bit field for conversion mode
Const IME_CMODE_ALPHANUMERIC = &H0
Const IME_CMODE_NATIVE = &H1
Const IME_CMODE_CHINESE = IME_CMODE_NATIVE
Const IME_CMODE_HANGEUL = IME_CMODE_NATIVE
Const IME_CMODE_JAPANESE = IME_CMODE_NATIVE
Const IME_CMODE_KATAKANA = &H2 ' only effect under IME_CMODE_NATIVE
Const IME_CMODE_LANGUAGE = &H3
Const IME_CMODE_FULLSHAPE = &H8
Const IME_CMODE_ROMAN = &H10
Const IME_CMODE_CHARCODE = &H20
Const IME_CMODE_HANJACONVERT = &H40
Const IME_CMODE_SOFTKBD = &H80
Const IME_CMODE_NOCONVERSION = &H100
Const IME_CMODE_EUDC = &H200
Const IME_CMODE_SYMBOL = &H400
Const IME_SMODE_NONE = &H0
Const IME_SMODE_PLAURALCLAUSE = &H1
Const IME_SMODE_SINGLECONVERT = &H2
Const IME_SMODE_AUTOMATIC = &H4
Const IME_SMODE_PHRASEPREDICT = &H8
' style of candidate
Const IME_CAND_UNKNOWN = &H0
Const IME_CAND_READ = &H1
Const IME_CAND_CODE = &H2
Const IME_CAND_MEANING = &H3
Const IME_CAND_RADICAL = &H4
Const IME_CAND_STROKE = &H5
' wParam of report message WM_IME_NOTIFY
Const IMN_CLOSESTATUSWINDOW = &H1
Const IMN_OPENSTATUSWINDOW = &H2
Const IMN_CHANGECANDIDATE = &H3
Const IMN_CLOSECANDIDATE = &H4
Const IMN_OPENCANDIDATE = &H5
Const IMN_SETCONVERSIONMODE = &H6
Const IMN_SETSENTENCEMODE = &H7
Const IMN_SETOPENSTATUS = &H8
Const IMN_SETCANDIDATEPOS = &H9
Const IMN_SETCOMPOSITIONFONT = &HA
Const IMN_SETCOMPOSITIONWINDOW = &HB
Const IMN_SETSTATUSWINDOWPOS = &HC
Const IMN_GUIDELINE = &HD
Const IMN_PRIVATE = &HE
' error code of ImmGetCompositionString
Const IMM_ERROR_NODATA = (-1)
Const IMM_ERROR_GENERAL = (-2)
' dialog mode of ImmConfigureIME
Const IME_CONFIG_GENERAL = 1
Const IME_CONFIG_REGISTERWORD = 2
Const IME_CONFIG_SELECTDICTIONARY = 3
' dialog mode of ImmEscape
Const IME_ESC_QUERY_SUPPORT = &H3
Const IME_ESC_RESERVED_FIRST = &H4
Const IME_ESC_RESERVED_LAST = &H7FF
Const IME_ESC_PRIVATE_FIRST = &H800
Const IME_ESC_PRIVATE_LAST = &HFFF
Const IME_ESC_SEQUENCE_TO_INTERNAL = &H1001
Const IME_ESC_GET_EUDC_DICTIONARY = &H1003
Const IME_ESC_SET_EUDC_DICTIONARY = &H1004
Const IME_ESC_MAX_KEY = &H1005
Const IME_ESC_IME_NAME = &H1006
Const IME_ESC_SYNC_HOTKEY = &H1007
Const IME_ESC_HANJA_MODE = &H1008
' style of word registration
Const IME_REGWORD_STYLE_EUDC = &H1
Const IME_REGWORD_STYLE_USER_FIRST = &H80000000
Const IME_REGWORD_STYLE_USER_LAST = &HFFFFFFFF
' type of soft keyboard
' for Windows Tranditional Chinese Edition
Const SOFTKEYBOARD_TYPE_T1 = &H1
' for Windows Simplified Chinese Edition
Const SOFTKEYBOARD_TYPE_C1 = &H2
' ***********************************************************************
' * *
' * mcx.h -- This module defines the 32-Bit Windows MCX APIs *
' * *
' * Copyright (c) 1990-1995, Microsoft Corp. All rights reserved. *
' * *
' ************************************************************************/
Type MODEMDEVCAPS
dwActualSize As Long
dwRequiredSize As Long
dwDevSpecificOffset As Long
dwDevSpecificSize As Long
' product and version identification
dwModemProviderVersion As Long
dwModemManufacturerOffset As Long
dwModemManufacturerSize As Long
dwModemModelOffset As Long
dwModemModelSize As Long
dwModemVersionOffset As Long
dwModemVersionSize As Long
' local option capabilities
dwDialOptions As Long ' bitmap of supported values
dwCallSetupFailTimer As Long ' maximum in seconds
dwInactivityTimeout As Long ' maximum in seconds
dwSpeakerVolume As Long ' bitmap of supported values
dwSpeakerMode As Long ' bitmap of supported values
dwModemOptions As Long ' bitmap of supported values
dwMaxDTERate As Long ' maximum value in bit/s
dwMaxDCERate As Long ' maximum value in bit/s
' Variable portion for proprietary expansion
abVariablePortion(1) As Byte
End Type
Type MODEMSETTINGS
dwActualSize As Long
dwRequiredSize As Long
dwDevSpecificOffset As Long
dwDevSpecificSize As Long
' static local options (read/write)
dwCallSetupFailTimer As Long ' seconds
dwInactivityTimeout As Long ' seconds
dwSpeakerVolume As Long ' level
dwSpeakerMode As Long ' mode
dwPreferredModemOptions As Long ' bitmap
' negotiated options (read only) for current or last call
dwNegotiatedModemOptions As Long ' bitmap
dwNegotiatedDCERate As Long ' bit/s
' Variable portion for proprietary expansion
abVariablePortion(1) As Byte
End Type
' Dial Options
Const DIALOPTION_BILLING = &H40 ' Supports wait for bong "$"
Const DIALOPTION_QUIET = &H80 ' Supports wait for quiet "@"
Const DIALOPTION_DIALTONE = &H100 ' Supports wait for dial tone "W"
' SpeakerVolume for MODEMDEVCAPS
Const MDMVOLFLAG_LOW = &H1
Const MDMVOLFLAG_MEDIUM = &H2
Const MDMVOLFLAG_HIGH = &H4
我20多年的VBA实践经验,全部浓缩在下面的各个教程中: