How to receive SPELCom events when VB message box is displayed
Symptoms
When a VB message box is displayed, SPELCom events are not received. VB Timers also do not fire events. Remedy Use the Windows API MessageBox function instead of the VB MsgBox function. Here is an example for creating a wrapper function called MyMsgBox that uses the API MessageBox function. The code below was added to a module file called SysMsgBox.bas. You can use MyMsgBox in place of MsgBox.
SPEL Code Example
Option Explicit
Private Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, _
ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
Function MyMsgBox(ByVal Prompt As String, Optional Buttons As VbMsgBoxStyle = vbOKOnly, _
Optional ByVal Title As String) As VbMsgBoxResult
' Note: Make sure to set hwnd argument below to your application main form's hwnd
MyMsgBox = MessageBox(frmMain.hwnd, Prompt, Title, Buttons)
End Function |

