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

六十四位Office中API函数声明语句第55讲

VBA语言専攻 2021-08-06
167

【分享成果,随喜正能量】与其抱怨命运不如改变命运,与其抱怨生活不如改善生活,当你停止抱怨的时候,生活就慢慢变好了。人无所舍,必无所成。一个人,能抓住希望的只有自己,能放弃希望也只有自己。怨恨、嫉妒只会让自己失去更多。无论成败,跌倒了,失去了,不要紧,爬起来继续风雨兼程,且歌且行。擦亮你的眼睛,别让迷茫蛊惑了自己。只有心中有岸,才会有渡口,才会有船只,才会有明天。

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

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



Type DLGITEMTEMPLATE

        style As Long

        dwExtendedStyle As Long

        x As Integer

        y As Integer

        cx As Integer

        cy As Integer

        id As Integer

End Type


Declare PtrSafe Function EndDialog Lib "user32" Alias "EndDialog" (ByVal hDlg As LongPtr, ByVal nResult As LongPtr) As Long

Declare PtrSafe Function GetDlgItem Lib "user32" Alias "GetDlgItem" (ByVal hDlg As LongPtr, ByVal nIDDlgItem As Long) As LongPtr

Declare PtrSafe Function SetDlgItemInt Lib "user32" Alias "SetDlgItemInt" (ByVal hDlg As LongPtr, ByVal nIDDlgItem As Long, ByVal wValue As Long, ByVal bSigned As Long) As Long

Declare PtrSafe Function GetDlgItemInt Lib "user32" Alias "GetDlgItemInt" (ByVal hDlg As LongPtr, ByVal nIDDlgItem As Long, ByVal lpTranslated As LongPtr, ByVal bSigned As Long) As Long

Declare PtrSafe Function SetDlgItemText Lib "user32" Alias "SetDlgItemTextA" (ByVal hDlg As LongPtr, ByVal nIDDlgItem As Long, ByVal lpString As String) As Long

Declare PtrSafe Function GetDlgItemText Lib "user32" Alias "GetDlgItemTextA" (ByVal hDlg As LongPtr, ByVal nIDDlgItem As Long, ByVal lpString As String, ByVal nMaxCount As Long) As Long

Declare PtrSafe Function CheckDlgButton Lib "user32" Alias "CheckDLGButtonA" (ByVal hDlg As LongPtr, ByVal nIDButton As Long, ByVal wCheck As Long) As Long

Declare PtrSafe Function CheckRadioButton Lib "user32" Alias "CheckRadioButtonA" (ByVal hDlg As LongPtr, ByVal nIDFirstButton As Long, ByVal nIDLastButton As Long, ByVal nIDCheckButton As Long) As Long

Declare PtrSafe Function IsDlgButtonChecked Lib "user32" Alias "IsDlgButtonChecked" (ByVal hDlg As LongPtr, ByVal nIDButton As Long) As Long

Declare PtrSafe Function SendDlgItemMessage Lib "user32" Alias "SendDlgItemMessageA" (ByVal hDlg As LongPtr, ByVal nIDDlgItem As Long, ByVal wMsg As Long, ByVal wParam As LongPtr, ByVal lParam As LongPtr) As LongPtr

Declare PtrSafe Function GetNextDlgGroupItem Lib "user32" Alias "GetNextDlgGroupItem" (ByVal hDlg As LongPtr, ByVal hCtl As LongPtr, ByVal bPrevious As Long) As LongPtr

Declare PtrSafe Function GetNextDlgTabItem Lib "user32" Alias "GetNextDlgTabItem" (ByVal hDlg As LongPtr, ByVal hCtl As LongPtr, ByVal bPrevious As Long) As LongPtr

Declare PtrSafe Function GetDlgCtrlID Lib "user32" Alias "GetDlgCtrlID" (ByVal hwnd As LongPtr) As Long

Declare PtrSafe Function GetDialogBaseUnits Lib "user32" Alias "GetDialogBaseUnits" () As Long

Declare PtrSafe Function DefDlgProc Lib "user32" Alias "DefDlgProcA" (ByVal hDlg As LongPtr, ByVal wMsg As Long, ByVal wParam As LongPtr, ByVal lParam As LongPtr) As LongPtr


Const DLGWINDOWEXTRA = 30        '  Window extra bytes needed for private dialog classes


Declare PtrSafe Function CallMsgFilter Lib "user32" Alias "CallMsgFilterA" (lpMsg As MSG, ByVal ncode As Long) As Long


' Clipboard Manager Functions

Declare PtrSafe Function OpenClipboard Lib "user32" Alias "OpenClipboard" (ByVal hwnd As LongPtr) As Long

Declare PtrSafe Function CloseClipboard Lib "user32" Alias "CloseClipboard" () As Long

Declare PtrSafe Function GetClipboardOwner Lib "user32" Alias "GetClipboardOwner" () As LongPtr

Declare PtrSafe Function SetClipboardViewer Lib "user32" Alias "SetClipboardViewer" (ByVal hwnd As LongPtr) As LongPtr

Declare PtrSafe Function GetClipboardViewer Lib "user32" Alias "GetClipboardViewer" () As LongPtr

Declare PtrSafe Function ChangeClipboardChain Lib "user32" Alias "ChangeClipboardChain" (ByVal hwnd As LongPtr, ByVal hWndNext As LongPtr) As Long

Declare PtrSafe Function SetClipboardData Lib "user32" Alias "SetClipboardDataA" (ByVal wFormat As Long, ByVal hMem As LongPtr) As LongPtr

Declare PtrSafe Function GetClipboardData Lib "user32" Alias "GetClipboardDataA" (ByVal wFormat As Long) As LongPtr

Declare PtrSafe Function RegisterClipboardFormat Lib "user32" Alias "RegisterClipboardFormatA" (ByVal lpString As String) As Long

Declare PtrSafe Function CountClipboardFormats Lib "user32" Alias "CountClipboardFormats" () As Long

Declare PtrSafe Function EnumClipboardFormats Lib "user32" Alias "EnumClipboardFormats" (ByVal wFormat As Long) As Long

Declare PtrSafe Function GetClipboardFormatName Lib "user32" Alias "GetClipboardFormatNameA" (ByVal wFormat As Long, ByVal lpString As String, ByVal nMaxCount As Long) As Long

Declare PtrSafe Function EmptyClipboard Lib "user32" Alias "EmptyClipboard" () As Long

Declare PtrSafe Function IsClipboardFormatAvailable Lib "user32" Alias "IsClipboardFormatAvailable" (ByVal wFormat As Long) As Long

Declare PtrSafe Function GetPriorityClipboardFormat Lib "user32" Alias "GetPriorityClipboardFormat" (lpPriorityList As Long, ByVal nCount As Long) As Long

Declare PtrSafe Function GetOpenClipboardWindow Lib "user32" Alias "GetOpenClipboardWindow" () As LongPtr

Declare PtrSafe Function CharToOem Lib "user32" Alias "CharToOemA" (ByVal lpszSrc As String, ByVal lpszDst As String) As Long

Declare PtrSafe Function OemToChar Lib "user32" Alias "OemToCharA" (ByVal lpszSrc As String, ByVal lpszDst As String) As Long

第1套教程:VBA代码解决方案

第2套教程:VBA数据库解决方案

第3套教程:VBA数组与字典解决方案

第4套教程:VBA代码解决方案之视频(第一套的视频讲解)

第5套教程:VBA中类的解读和利用

第6套教程:VBA信息获取与处理

第7套教程:VBA之EXCEL应用

第8套教程:VBA之Word应用(最新推出)

上述教程的学习顺序:

① 7→1→3→2→6→5或者7→4→3→2→6→5。

② 7→8


文章转载自VBA语言専攻,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论