64位OfficeAPI声明语句第117讲

VBA语言専攻 2024-04-06 18:30:49

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

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

【分享成果,随喜正能量】 万物皆有灵,草木亦有心。这世间,万事万物都是有回音的,大至一世界,小至一微粒,你拿出十分的善意,定会收到它以一百分的温柔回馈。。

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

Const SHAREVISTRING = "commdlg_ShareViolation"

Const FILEOKSTRING = "commdlg_FileNameOK"

Const COLOROKSTRING = "commdlg_ColorOK"

Const SETRGBSTRING = "commdlg_SetRGBColor"

Const HELPMSGSTRING = "commdlg_help"

Const FINDMSGSTRING = "commdlg_FindReplace"

Const CD_LBSELNOITEMS = -1

Const CD_LBSELCHANGE = 0

Const CD_LBSELSUB = 1

Const CD_LBSELADD = 2

Type PRINTDLG

lStructSize As Long

hwndOwner As LongPtr

hDevMode As LongPtr

hDevNames As LongPtr

hdc As LongPtr

flags As Long

nFromPage As Integer

nToPage As Integer

nMinPage As Integer

nMaxPage As Integer

nCopies As Integer

hInstance As LongPtr

lCustData As LongPtr

lpfnPrintHook As LongPtr

lpfnSetupHook As LongPtr

lpPrintTemplateName As String

lpSetupTemplateName As String

hPrintTemplate As LongPtr

hSetupTemplate As LongPtr

End Type

Declare PtrSafe Function PrintDlg Lib "comdlg32.dll" Alias "PrintDlgA" (pPrintdlg As PRINTDLG) As Long

Const PD_ALLPAGES = &H0

Const PD_SELECTION = &H1

Const PD_PAGENUMS = &H2

Const PD_NOSELECTION = &H4

Const PD_NOPAGENUMS = &H8

Const PD_COLLATE = &H10

Const PD_PRINTTOFILE = &H20

Const PD_PRINTSETUP = &H40

Const PD_NOWARNING = &H80

Const PD_RETURNDC = &H100

Const PD_RETURNIC = &H200

Const PD_RETURNDEFAULT = &H400

Const PD_SHOWHELP = &H800

Const PD_ENABLEPRINTHOOK = &H1000

Const PD_ENABLESETUPHOOK = &H2000

Const PD_ENABLEPRINTTEMPLATE = &H4000

Const PD_ENABLESETUPTEMPLATE = &H8000&

Const PD_ENABLEPRINTTEMPLATEHANDLE = &H10000

Const PD_ENABLESETUPTEMPLATEHANDLE = &H20000

Const PD_USEDEVMODECOPIES = &H40000

Const PD_USEDEVMODECOPIESANDCOLLATE = &H40000

Const PD_DISABLEPRINTTOFILE = &H80000

Const PD_HIDEPRINTTOFILE = &H100000

Const PD_NONETWORKBUTTON = &H200000

Type DEVNAMES

wDriverOffset As Integer

wDeviceOffset As Integer

wOutputOffset As Integer

wDefault As Integer

End Type

Const DN_DEFAULTPRN = &H1

Declare PtrSafe Function CommDlgExtendedError Lib "comdlg32.dll" Alias "CommDlgExtendedError" () As Long

Const WM_PSD_PAGESETUPDLG = (WM_USER)

Const WM_PSD_FULLPAGERECT = (WM_USER + 1)

Const WM_PSD_MINMARGINRECT = (WM_USER + 2)

Const WM_PSD_MARGINRECT = (WM_USER + 3)

Const WM_PSD_GREEKTEXTRECT = (WM_USER + 4)

Const WM_PSD_ENVSTAMPRECT = (WM_USER + 5)

Const WM_PSD_YAFULLPAGERECT = (WM_USER + 6)

Type PAGESETUPDLG

lStructSize As Long

hwndOwner As LongPtr

hDevMode As LongPtr

hDevNames As LongPtr

flags As Long

ptPaperSize As POINTAPI

rtMinMargin As RECT

rtMargin As RECT

hInstance As LongPtr

lCustData As LongPtr

lpfnPageSetupHook As LongPtr

lpfnPagePaintHook As LongPtr

lpPageSetupTemplateName As String

hPageSetupTemplate As LongPtr

End Type

Declare PtrSafe Function PageSetupDlg Lib "comdlg32.dll" Alias "PageSetupDlgA" (pPagesetupdlg As PAGESETUPDLG) As Long

Const PSD_DEFAULTMINMARGINS = &H0 ' default (printer's)

Const PSD_INWININIINTLMEASURE = &H0 ' 1st of 4 possible

Const PSD_MINMARGINS = &H1 ' use caller's

Const PSD_MARGINS = &H2 ' use caller's

Const PSD_INTHOUSANDTHSOFINCHES = &H4 ' 2nd of 4 possible

Const PSD_INHUNDREDTHSOFMILLIMETERS = &H8 ' 3rd of 4 possible

Const PSD_DISABLEMARGINS = &H10

Const PSD_DISABLEPRINTER = &H20

Const PSD_NOWARNING = &H80 ' must be same as PD_*

Const PSD_DISABLEORIENTATION = &H100

Const PSD_RETURNDEFAULT = &H400 ' must be same as PD_*

Const PSD_DISABLEPAPER = &H200

Const PSD_SHOWHELP = &H800 ' must be same as PD_*

Const PSD_ENABLEPAGESETUPHOOK = &H2000 ' must be same as PD_*

Const PSD_ENABLEPAGESETUPTEMPLATE = &H8000& ' must be same as PD_*

Const PSD_ENABLEPAGESETUPTEMPLATEHANDLE = &H20000 ' must be same as PD_*

Const PSD_ENABLEPAGEPAINTHOOK = &H40000

Const PSD_DISABLEPAGEPAINTING = &H80000

Declare PtrSafe Function DdeInitialize Lib "user32" Alias "DdeInitializeA" (pidInst As Long, ByVal pfnCallback As LongPtr, ByVal afCmd As Long, ByVal ulRes As Long) As Long

Declare PtrSafe Function SetServiceBits Lib "advapi32" Alias "SetServiceBits" (ByVal hServiceStatus As LongPtr, ByVal dwServiceBits As Long, ByVal bSetBitsOn As Long, ByVal bUpdateImmediately As Long) As Long

Declare PtrSafe Function CopyLZFile Lib "lz32" Alias "CopyLZFile" (ByVal n1 As Long, ByVal n2 As Long) As Long

Declare PtrSafe Function LZStart Lib "lz32" Alias "LZStart" () As Long

Declare PtrSafe Sub LZDone Lib "lz32" Alias "LZDone" ()

Declare PtrSafe Function mciGetYieldProc Lib "winmm" Alias "mciGetYieldProc" (ByVal mciId As Long, pdwYieldData As Long) As LongPtr

Declare PtrSafe Function mciSetYieldProc Lib "winmm" Alias "mciSetYieldProc" (ByVal mciId As Long, ByVal fpYieldProc As LongPtr, ByVal dwYieldData As Long) As Long

Declare PtrSafe Function midiOutGetNumDevs Lib "winmm" Alias "midiOutGetNumDevs" () As Long

Declare PtrSafe Function mmioInstallIOProcA Lib "winmm" Alias "mmioInstallIOProcA" (ByVal fccIOProc As Long, ByVal pIOProc As LongPtr, ByVal dwFlags As Long) As LongPtr

Declare PtrSafe Function CommandLineToArgv Lib "shell32" Alias "CommandLineToArgvW" (ByVal lpCmdLine As String, pNumArgs As Long) As LongPtr

Declare PtrSafe Function IsTextUnicode Lib "advapi32" Alias "IsTextUnicode" (lpBuffer As Any, ByVal cb As Long, lpi As Long) As Long

Declare PtrSafe Function NotifyChangeEventLog Lib "advapi32" Alias "NotifyChangeEventLog" (ByVal hEventLog As LongPtr, ByVal hEvent As LongPtr) As Long

Declare PtrSafe Function SetThreadToken Lib "advapi32" Alias "SetThreadToken" (Thread As LongPtr, ByVal Token As LongPtr) As Long

Type COMMCONFIG

dwSize As Long

wVersion As Integer

wReserved As Integer

dcbx As DCB

dwProviderSubType As Long

dwProviderOffset As Long

dwProviderSize As Long

wcProviderData As Integer

End Type

Declare PtrSafe Function CommConfigDialog Lib "kernel32" Alias "CommConfigDialogA" (ByVal lpszName As String, ByVal hWnd As LongPtr, lpCC As COMMCONFIG) As Long

Declare PtrSafe Function CreateIoCompletionPort Lib "kernel32" Alias "CreateIoCompletionPort" (ByVal FileHandle As LongPtr, ByVal ExistingCompletionPort As LongPtr, ByVal CompletionKey As LongPtr, ByVal NumberOfConcurrentThreads As Long) As LongPtr

Declare PtrSafe Function DisableThreadLibraryCalls Lib "kernel32" Alias "DisableThreadLibraryCalls" (ByVal hLibModule As LongPtr) As Long

Declare PtrSafe Function EnumResourceLanguages Lib "kernel32" Alias "EnumResourceLanguagesA" (ByVal hModule As LongPtr, ByVal lpType As String, ByVal lpName As String, ByVal lpEnumFunc As LongPtr, ByVal lParam As LongPtr) As Long

Declare PtrSafe Function EnumResourceNames Lib "kernel32" Alias "EnumResourceNamesA" (ByVal hModule As LongPtr, ByVal lpType As String, ByVal lpEnumFunc As LongPtr, ByVal lParam As LongPtr) As Long

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

0 阅读:7