I wrote a Visual Basic 6 program and included a command button to stop the program

Below is the code I used to stop the program


Private Sub cmdStop_Click()
Unload Me
End
End Sub

The program plays a short wav file every sixty seconds to let the user know it’s still running. Of course it does other stuff too.

I created an Executable and the command button works fine and completely stops the application. After I click the command button the program disappears from the Task Manage.

When I click the Red X in the upper right corner the window closes but the task continues running, it doesn’t disappear from the Task Manager and it continues playing the sound file every sixty seconds.

How do I force a clean completely close?

Thanks