|
-
Aug 9th, 2002, 01:39 PM
#1
Thread Starter
New Member
ActiveX Exe - RunTime Error 462
Good Afternoon,
Problem:
Standard EXE - uses ActiveX Exe as a class error handler
If I kill (simulating an ActixeX Exe crash) the ActiveX Exe process thereby eliminating the ability of my Standard Exe to handle errors, how can I:
1. Restart the ActiveX Exe without restarting the main standard Exe?
2. Trap the error (#462) so I can start a different process or perhaps handle the error in another manner?
Thank you for your assistance.
-
Aug 9th, 2002, 02:32 PM
#2
You need to trap the origin of the error in the ActiveX Exe so that it doesn't get muddled up. Maybe add some generic error handling for unexpected errors.
-
Aug 9th, 2002, 03:31 PM
#3
Thread Starter
New Member
How will that work?
Thank you for your reply.
I am not sure how I can create a generic error handler within the ActiveX Exe since that process will no longer exist anyway.
In addition, the error handler I have in the Standard Exe apparently will not recognize the error until it attempts to call either a Property Set or Public Function (Method) and at that point generates a run-time error vs allowing me to supersede that error and test for it.
How can I test for the existence of the ActiveX Exe process prior to calling it?
How can I restart the process if stopped/killed without restarting the Standard Exe?
Thank you for your help.
-
Aug 9th, 2002, 03:44 PM
#4
See what I believe is happening is an unhandled error is happening in the ActiveX exe which causes it to close. As a result the next call to a property or method in the activeX exe from the calling standard exe causes the error you are getting. Either that or the error could be coming directly from the activeX exe, have you tested for this? To stop/restart the activeX exe you'd probably have to set the object to nothing and create a new instance from within your standard exe. It still may go bugger on you though. You could also try testing to see if the activex exe is nothing before calling the property and/or methods, but I'm not sure it sets itself to nothing with an error.
-
Aug 9th, 2002, 04:25 PM
#5
Thread Starter
New Member
Actually, the ActiveX Exe is not failing at all at this point. I am manually killing the process through Task Manager to simulate a crash.
It is my intention to prevent this problem should the need arise.
However; your point about testing for nothing is an interesting one, and I will try that shortly. If I can determine it does not exist first before calling it, then I can re-instantiate it and move forward.
Thank you.
-
Aug 9th, 2002, 05:47 PM
#6
Thread Starter
New Member
Unfortunately, testing for nothing did not help.
Even though the actual process is not running, it was never set to "Nothing" therefore; my question is returned with "False."
The problem also lies with the error happening during the error handling routine. Here is a snippet (the problem occurs when I attempted to set a property, NOT when using the WITH statement):
Code:
'Some code to handle an event causes an error
ErrorHandler:
'Set Error Parameters
With ErrClass
.ErrorNumber = Err.Number
.ErrorDescription = Err.Description
.ModuleName = "frmVirtualKeyboard"
.ProcedureName = "cmdKeys_Click(" & Index & ") - Character: " & Index
End With 'ErrClass
'Process Error
Select Case ErrClass.fProcessError
Case 0
Resume
Case 1
Resume Next
Case 2
'Close Form
Call CloseForm(Me)
Case 3
'Close Application
Call CloseApplication
End Select 'ErrClass.fProcessError
Last edited by MusicMan; Aug 9th, 2002 at 05:50 PM.
-
Aug 9th, 2002, 06:27 PM
#7
Where is the error popping up? Also I guess it is good to be prepared but what would cause your activeX exe to crash but not your app (other than someone using the task manager)?
Hmm I can see the pickle of trapping on error of an error handler...
Maybe somethign like this:
VB Code:
Private Sub Handler(Desc As String)
On Error GoTo AhhHa
'handle error hear
Dim x
'sim activex error
x = 1 / 0
Exit Sub
AhhHa:
MsgBox Desc
End Sub
Private Sub Command1_Click()
On Error GoTo Err1
Dim x
'cause error
x = 1 / 0
Exit Sub
Err1:
'store err info in something else that is safe
Dim errStr As String
errStr = Err.Description
'call method so you can trap another error
Handler errStr
End Sub
Have the error info stored in something safe and passed to a general method that way it resets the error handling and you can catch the error on the activex object.
-
Aug 9th, 2002, 11:38 PM
#8
Thread Starter
New Member
Thank you.
I was contemplating that option earlier, but did not implement it. I would think there would be a method in which I could check the "running status" of a process - although if I dig deep enough into the WinAPI's I could find one.
Your suggestion is probably the best method, basically a "wrapper" for lack of a better term.
As to why the ActiveX Exe would crash and not the Standard Exe, couldn't tell ya', just trying to be prepared - or maybe over prepared. 
Thanks for the info and help.
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
|