2011/11/19

Office2010 Win32API MessageBoxEX

使う予定がこっちの方だった。


Option Compare Database
Option Explicit

#If VBA7 Then
Private Declare PtrSafe Function MessageBoxExW Lib "user32" ( _
                                    ByVal hwnd As LongPtr, _
                                    ByVal lpText As LongPtr, _
                                    ByVal lpCaption As LongPtr, _
                                    ByVal uType As Long, _
                                    ByVal wLanguageId As Long _
                                    ) As Long
#Else
Private Declare Function MessageBoxExW Lib "user32" ( _
                                    ByVal hwnd As Long, _
                                    ByVal lpText As Long, _
                                    ByVal lpCaption As Long, _
                                    ByVal uType As Long, _
                                    ByVal wLanguageId As Long _
                                    ) As Long
#End If

Function MsgBoxWEX(Prompt As String, _
                   Optional buttons As VbMsgBoxStyle = 0, _
                   Optional title As String, _
                   Optional languageID As Long = 1041 _
                   ) As VbMsgBoxResult
    
    If Len(title & "") = 0 Then title = Application.Name
    MsgBoxWEX = MessageBoxExW(Application.hWndAccessApp, _
                             StrPtr(Prompt), _
                             StrPtr(title), _
                             buttons, languageID)
End Function

0 件のコメント: