BUG: App.End in the Form Load Event Causes Application Error

Last reviewed: February 5, 1998
Article ID: Q180520
The information in this article applies to:
  • 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:

  1. 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.

  2. 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 bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Behavior

WARNING: The following code will generate a fatal application error.

  1. Create a new Windows CE project in Visual Basic 5.0. Form1 is created by default.

  2. Add the following code to the Form Load event:

          Private Sub Form_Load()
    
              'WARNING: Generates a fatal application error.
              App.End
          End Sub
    
    

  3. Press the F5 key to run the project.

(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Mike Dixon, Microsoft Corporation
Keywords          : vb5all vbce kberrmsg
Version           : WINDOWS:1.0
Platform          : WINDOWS
Issue type        : kbbug
Solution Type     : kbpending


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 5, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.