Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

urgent: windows error on exit .exe 1

Status
Not open for further replies.

Hokkie

MIS
Nov 21, 2001
77
NL
I have an application that resides in the system tray and checks every so often whether pop3 servers have received new mail via a winsock control. The only way to exit this appllication is to right click the icon and select 'Exit'.

This works without a problem in the IDE, but when run as a stand-alone executable Windows gives me the "Tell Microsoft about this problem" dialog. This is the error's signature:

AppName: pop3 check.exe AppVer: 0.8.0.9 ModName: kernel32.dll
ModVer: 5.1.2600.2180 Offset: 0001eb33

So... probably something in kernel32.dll? Any ideas? My exit code is the following:

Code:
Public Sub dsCloseApplication()
'----------------------------------------------------------------------------------
' Purpose : Removes the tray icon, closes the winsock connection, closes all forms,
'           sets the classes to nothing and exits the application
' Inputs  : None
' Returns : Nothing
' Outputs : Nothing
' Notes   : None
' Usage   : BL.dsCloseApplication
' Author  : Marco Hokke
' Date    : 26-10-2004
'----------------------------------------------------------------------------------

On Error GoTo ErrHandler
  
  'remove the icon from the system tray
  UCL.dsDeleteTrayIcon

  'close any winsock connections
  frmMain.Winsock1.Close

  'local variable to loop through forms
  Dim frm As Form

  'loop through the forms in this application and close all of them
  For Each frm In Forms
    Unload frm
  Next

  'clear the classes
  Set DCL = Nothing
  Set DL = Nothing
  Set UCL = Nothing

  'exit application
  End
  
ErrHandler:
  dsSemReport dfSemCreate("clsBusinessLayer:dsCloseApplication", Err.Number, Err.Description & vbCrLf & "POP3 Check will now terminate.")
  End
End Sub

I tried putting the end statement in any conceivable place in this sub and even in the event that calls this routine, but I still get the same error. So it's probably not my exit code--but then, what is it??

Any ideas on where to start would be great.

__________________
code is enduring
 
Uhm, as an addition to the analysis, I do not use any functions from kernel32.dll in my application. The only thing I can think of now that might cause this is the MB Tray control that I use... anyone have similar problems with it?

__________________
code is enduring
 
Allright, I tracked the problem to the MB Tray control. I implemented another way of getting a system tray icon (taken from removed the MB Tray control, and my executable doesn't give the Windows error anymore.

Hey, can I give myself a star? :)

__________________
code is enduring
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top