• Welcome to Valhalla Legends Archive.
 

VB6 Crashes when exiting app

Started by Antarctica, November 23, 2007, 05:26 PM

Previous topic - Next topic

Antarctica

I'm having quite a weird problem.  With my project, when I run it, then close it out, vb6 locks up and i have to crash it.  Anyone heard of this?

It only seems to happen when the Form design window is open.

Barabajagal

1) Are you using "End"?
2) Are you using the INet (Microsoft Internet Transfer) control?
3) Are you using subclassing?

Antarctica

1: Yes, on both Form_Unload and Form_Terminate
2: No
3: Please explain what this means (sorry for being newb)

Barabajagal

Never, EVER use End. It is the absolute worst thing you can do. Remove it immediately.

Subclassing is where you write code that goes before the built in system message handling in VB. It can be used in a variety of ways to intercept or send messages to or from applications. For instance, you can hook WM_MMI, which is the system message for resizing windows, to prevent a window from getting smaller or larger than defined values.

Antarctica

No, I don't remember doing anything fancy like that  :-\

Barabajagal

Well, get rid of End in both instances. When you need to close a window, use Unload Me. When you need to close all the windows, use a For Each loop, like so:


Dim Frm as Form
    For Each Frm in Forms
        Unload Frm
    Next Frm

brew

Are you using a winsock control, and using a text IP? (such as, valhallalegends.com)
Doing this, then trying to close it may "hang" vb6 for a while then crash. I have this problem.
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

Antarctica


brew

#8
I guess that's your problem. It happens to about what seems like every 1/9 people who use vb6, including me. I know of no way to fix that. Just revolve it yourself, by using gethostbyname.
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

vuther.de

I know how you feel about VB6 always freezing or crashing. It made me so mad. I never could find out why it did that until my later years of programming.

Hell-Lord

Quote from: Andy on November 23, 2007, 06:00 PM
Well, get rid of End in both instances. When you need to close a window, use Unload Me. When you need to close all the windows, use a For Each loop, like so:


Dim Frm as Form
    For Each Frm in Forms
        Unload Frm
    Next Frm


Dim frm as Form
For Each frm In Forms
Unload frm
Set frm = Nothing
Next

fixed ;)

Dale

Make sure on Form_Terminate and Form_Close and stuff, you do wSck.Close because, if I don't, then usually I'll freeze up as well.

Hell-Lord

I find QueryUnload good to use too, it is fired before the terminate and unload events and allows the user to specify what to do when a particular method has been used to close the applications.

Private Sub Form_QueryUnload(Cancel As Integer, _
UnloadMode As Integer)
Select Case UnloadMode
Case 0:
' User used the 'X' in the corner to close
' the application
Case 1:
' Some other code within this application is invoked
' and is closing the application.
Case 2:
' Windows session is closing (i.e. Start, Shut Down)
Case 3:
' Task Manager is closing this application. (i.e.
' Ctrl+Alt+Del, End Task)
Case 4:
' The MDI parent form is closing.
End Select
End Sub


And yes you should do what Dale said if the Winsock is not already closed.

Warrior

Quote from: inner.de on November 23, 2007, 11:13 PM
I know how you feel about VB6 always freezing or crashing. It made me so mad. I never could find out why it did that until my later years of programming.

The problem is you were using VB6 after years of programming.
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

Dale

Quote from: Warrior on November 25, 2007, 06:19 PM
Quote from: inner.de on November 23, 2007, 11:13 PM
I know how you feel about VB6 always freezing or crashing. It made me so mad. I never could find out why it did that until my later years of programming.

The problem is you were using VB6 after years of programming.

Trolling much? :-\