Attribute VB_Name = "MessageModule"
Option Explicit
Public Enum MYMSGFLAGS
    M_Ok
    M_Yes
    M_Cancel
    M_No
    M_Abort
    M_Retry
    M_OkCancel
    M_OkCancelRetry
    M_OkCancelAbort
    M_YesNo
    M_YesNoCancel
    M_YesNoAbort
    M_YesNoRetry
    M_YesCancel
    M_YesAbort
    M_YesRetry
    M_NoCancel
    M_NoAbort
    M_NoRetry
End Enum

Public Enum MYFORMAT
    F_String
    F_Number
    F_Date
    F_Time
End Enum

Public Function GiveMessage(ByVal sMessage As String, Optional ByVal lMsgOption As MYMSGFLAGS, Optional Hwnd As Long = 0) As MYMSGFLAGS
    EnableWindow Hwnd, 0
    Dim NForm As New MsgForm
    NForm.MyMessage = sMessage
    NForm.MyFlag = lMsgOption
    NForm.Show
    Do
        DoEvents
    Loop Until NForm.Visible = False
    GiveMessage = NForm.MyFlag
    BringWindowToTop Hwnd
    EnableWindow Hwnd, 1
End Function

Public Function GetMessage(ByVal sMessage As String, Optional sTitle As String = "Entrer un texte", Optional Hwnd As Long, Optional sDefaultValue As String = "") As String
    EnableWindow Hwnd, 0
    Dim NForm As New TextInputForm
    With NForm
        .MyMessage = sMessage
        .MyTitle = sTitle
        .InfoTxt.Text = sDefaultValue
        SelectInside .InfoTxt
        .Show
        Do
            DoEvents
        Loop Until .Visible = False
        GetMessage = .MyText
    End With
    EnableWindow Hwnd, 1
End Function
