FIX: App.End in the Form Load Event Causes Application Error
ID: Q180520
|
The information in this article applies to:
-
Microsoft Windows CE Toolkit for Visual Basic 5.0, version 1.0
SYMPTOMS
If the App.End method is used in the Form Load event, it will cause the
following application error in PVB.EXE on the emulator:
The instruction at "0x0135baa1" referenced memory at "0x00000000".
The memory could not be "read".
On the device, a message box with the title "Fatal Application Error" will
appear and automatically go away before it can be read.
RESOLUTION
There two possible workarounds for this bug:
- Use a timer to invoke the App.End method. Simply placing App.End in the
Timer Event and enabling the Timer at the desired time would end the
application.
- Set a flag during the Form Load event and, when the Form Activate event
is called, check the flag and end the application if the flag has been
set. Add the following code to a form to demonstrate this:
Option Explicit
Dim bEndAppFlag
Private Sub Form_Activate()
If bEndAppFlag Then App.End
End Sub
Private Sub Form_Load()
On Error Resume Next
'Simulate an error
Err.Raise 53
If Err.Number <> 0 Then
'An error occurred during form load,
'so exit the app by setting our flag.
bEndAppFlag = True
End If
End Sub
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed
at the beginning of this article.
This problem was corrected in Windows CE Toolkit for Visual Basic 6.0.
MORE INFORMATION
Steps to Reproduce Behavior
WARNING: The following code will generate a fatal application error.
- Create a new Windows CE project in Visual Basic 5.0. Form1 is created by
default.
- Add the following code to the Form Load event:
Private Sub Form_Load()
'WARNING: Generates a fatal application error.
App.End
End Sub
- Press the F5 key to run the project.
© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Mike Dixon, Microsoft Corporation
Additional query words:
wince vbce vbce5 vbce6
Keywords : kbToolkit kbVBp kbVBp500bug kbVBp600fix kbWinCE kbWinCE100 kbGrpVB
Version : WINDOWS:1.0
Platform : WINDOWS
Issue type : kbbug