Subject: Splash form problems
Posted By: mwphillips Post Date: 11/18/2003 4:21:51 PM
I have a VB6 SP5 application that compiles and runs. When I run the application in Visual Studio, VB6 crashes after about 2-4 start/stop cycles for the application. I stop the application by clicking on the application's exit button, not through the toolbar in visual studio. If I compile and install the application it does not crash (i.e. exhibit this behavior).

I tracked down the point of failure and it occurs when the application loads the splash form (about 4 lines into the code!). Note, the application only crashes when it is loading the splash form and not when the application exits.

The splash form only has a couple of labels and 2 bitmap images. If I remove the images from the splash form, the application does not crash in Visual Studio. I added the images to the splash screen at design time using the Picture property.

I hope I am not chasing ghosts, but it bothers me that my app makes VB6 crash consistently when run from Visual Studio.

I would appreciate any and all suggestions for solving this problem!

Thanks!

Mark

Code for the splash form:
Option Explicit

Private Sub Form_Load()
  With Me
    .Top = (Screen.Height - .Height) / 2
    .Left = (Screen.Width - .Width) / 2
    .lblTitle.Caption = gTITLE
    .lblProduct.Caption = gPRODUCT
    .lblVersion.Caption = "v" & App.Major & "." & App.Minor & "." & App.Revision
    .lblDescription.Caption = gDESCRIPTION
    .lblNotice.Caption = gNOTICE
  End With
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
    Unload Me
End Sub

Private Sub Form_Terminate()
    'Debug.print "*** Terminate frmSplash"
End Sub


Code in SubMain to launch the app:
Sub Main()
    On Error GoTo ErrorHandler
    'show the splash screen for a minimum of SPLASH_SCREEN_DELAY milliseconds
    'while getting everything ready
    m_blnTimerDone = False
    m_blnLogEnabled = False
    m_lngTimerID = SetTimer(0, 0, SPLASH_SCREEN_DELAY, AddressOf Timer_CBK)
'    frmSplash.Show
    frmTest.Show
    DoEvents
    '...and we crash before DoEvents!

Reply By: pgtips Reply Date: 11/19/2003 4:02:24 AM
Maybe nothing to do with it, but the params you're passing to SetTimer don't look right.  Isn't the first arg supposed to be either a window handle (e.g. Me.hWnd) or Null?

Go to topic 6323

Return to index page 1002
Return to index page 1001
Return to index page 1000
Return to index page 999
Return to index page 998
Return to index page 997
Return to index page 996
Return to index page 995
Return to index page 994
Return to index page 993