Calling MessageBoxTimeout function from user32.dll is not returning timeout when using iType = vbInformation, it always returns vbOK, so I can not know when a timeout error occurs.
Code is following:
Public Function MsgBoxDelay(strMsg As String, strTitle As String, iTimeout As Long, iType As Integer) As Integer
On Error GoTo _error
MsgBoxDelay = MessageBoxTimeout(FrmFoo.hwnd, strMsg, strTitle, iType, 0, iTimeout * 1000)
If MsgBoxDelay <> vbYes And MsgBoxDelay <> vbNo And MsgBoxDelay <> vbOK Then
Call SaveLog("MsgBoxDelay: Timeout Error")
gbAATimedOut = True
End If
Exit Function
_error:
MsgBox "VB Error - Function MsgBoxDelay: " & vbCrLf & vbCrLf _
& "Number: " & Err.Number & vbCrLf _
& "Description: " & Err.Description, vbCritical, "Error!"
End Function
Has anyone had this problem?
Thanks in advance.
Declare Auto Function MBoxTime Lib "user32.dll" Alias "MessageBoxTimeout" (
ByVal hwnd As IntPtr,
ByVal text As String,
ByVal title As String,
ByVal type As UInteger,
ByVal wLanguageId As Int16,
ByVal milliseconds As Int32) As Integer
test:
MBoxTime(New System.IntPtr(0), "Something went wrong!", "Process pic", 0, 0, 3000)