Msgbox e Inputbox
MSGBOX TEMPORAL Y AUTOMATICO
Declare Function KillTimer Lib "User32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function SetTimer Lib "User32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
'http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=27940&lngWId=1
'Mensaje = " Atención existe un pedido con los mismos datos, ya contabilizado"
'respuesta = MsgBoxEx(Me.hwnd, Mensaje, 2, vbCritical, "Balances")
Public Sub TimerProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long)
Dim hMessageBox As Long
On Error GoTo TimerProc_Error
KillTimer hwnd, idEvent
hMessageBox = FindWindow("#32770", msgTitle)
If hMessageBox Then
SendMessage hMessageBox, WM_COMMAND, 6&, 0&
End If
On Error GoTo 0
Exit Sub
TimerProc_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure TimerProc of Módulo Mdl_Msgbox"
End Sub
Public Function MsgBoxEx(hwnd As Long, Prompt, Optional cSeconds As Long = 1, Optional Buttons As VbMsgBoxStyle, Optional Title, Optional HelpFile, Optional Context) As Long 'VbMsgBoxResult
Dim cMSeconds As Long
On Error GoTo MsgBoxEx_Error
cMSeconds = cSeconds * 1000
Title = IIf(Title = "", "Balances", Title)
msgTitle = Title
SetTimer hwnd, 0&, cMSeconds&, AddressOf TimerProc
MsgBoxEx = MsgBox(Prompt, Buttons, Title, HelpFile, Context)
On Error GoTo 0
Exit Function
MsgBoxEx_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure MsgBoxEx of Módulo Mdl_Msgbox"
End Function