|
-
Jul 5th, 2000, 02:47 PM
#1
Thread Starter
Member
Hi. I'm writing a program that calls a procedure that is in a DLL. When the procedure fails, I have error handling to exit the program. The problem is that when the program exits, the entire VB design environment exits also. This only happens to me when I get an error using a DLL. Does anyone know how to prevent the VB design environment from exiting also? Thanks!
-
Jul 5th, 2000, 08:21 PM
#2
Lively Member
hi,
can you write down the error handler so i can maybe see what you wrote and maybe something is wrong. if you just wrote "End" then i haven't a clue.
-
Jul 6th, 2000, 07:58 AM
#3
Thread Starter
Member
On Error GoTo safe
safe:
MsgBox "Error # " & CStr(Err.Number) & " " & Err.Description
Err.Clear
Set session = Nothing 'gets rid of object that uses dll
Exit Sub
The "on error" statement is of course at the beginning of the sub while everything past the "safe:" anchor is at the end. Everything seems to work fine except when I hit the terminate button on the application or the stop button in the vb design environment, my program quits but unfortunately the entire vb design environment quits with it. It's frustating because I have to keep going back into it.
-
Jul 6th, 2000, 08:02 AM
#4
Thread Starter
Member
actually, here, I'll give you the entire program:
Option Explicit
Dim session As Object
Dim folder As Object
Dim msgs As Object
Dim mess As Object
Private Sub Form_Load()
On Error GoTo safe
Set session = CreateObject("CTI.Session.1")
session.CTLogon "WM2", "jrumajas", "mandrake"
Set folder = session.Inbox
Set msgs = folder.Messages
Set mess = msgs.GetFirst
MsgBox mess.Text
MsgBox "the length of body is: " & Len(mess.Text)
Set mess = Nothing
Set mess = session.Inbox.Messages.GetNext
MsgBox mess.Text
MsgBox "the length of body is: " & Len(mess.Text)
Set mess = Nothing
Set msgs = Nothing
Set folder = Nothing
session.Logoff
MsgBox "Done "
session = Nothing
safe:
MsgBox "Error # " & CStr(Err.Number) & " " & Err.Description
Err.Clear ' Clear the error.
'Resume Next
Set session = Nothing
'End
Exit Sub
End Sub
The error says:
Error #-2147221227 Method 'CTLogon' of object 'ISession' failed.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|