PRB: VB5.0 OLE Automation Error --2147418107 (80010005) (176399)
The information in this article applies to:
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Learning Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q176399 SYMPTOMS
When a compiled Visual Basic application makes calls to an ActiveX
server via a timer event, the following error may occur:
Run-time error '-2147418107 (80010005)': Automation error
CAUSE
After the first WM_TIMER event is fired, subsequent WM_TIMER events cannot
be processed until the first event is completed. The error message equates
to:
It is illegal to call out while inside message filter.
RESOLUTION
Three workarounds have been implemented with success:
Workaround 1
Set a boolean flag in the timer event (see code listed in the Steps to
Reproduce Behavior section below).
- Select Project .Add Module and add a standard module
- Type the following code into the module:
Public flag As Boolean
- Change the Timer1_Timer event code to read as follows:
Private Sub Timer1_Timer()
If Not flag Then
flag = True
RetStr = t.Test(100000)
flag = False
End If
Text1.Text = RetStr
End Sub
By doing this, the timer can't call the server until the previous call is
completed.
Workaround 2
Create the server as a DLL, not an EXE. ActiveX DLLs are in-process
servers. An in-process server would not use Remote Procedure Call engine
(RPC). (See the MORE INFORMATION below.)
Workaround 3
Place error handling in effect to ignore the error:
Private Sub Timer1_Timer()
On Error Resume Next
RetStr = t.Test(100000)
End Sub
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 5/13/2003 |
---|
Keywords: | kberrmsg kbprb KB176399 |
---|
|