Error catching in Outside Apps

mcguirepm
12-21-2004, 12:15 PM
I'm amusing VB.Net to control various functions in Visual Manufacturing, an MRP system. What I need to find out is how do I capture any errors that my occur. For instance, I am using the following code to open a spcific work order, but how do I capture if the outside application throws an error that the Workorder was not found?

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim retval As MsgBoxResult
Dim MyAppID As Integer
On Error GoTo ERRRUNNING
' Run VisMfg.
MyAppID = Shell("V:\VMMFGWIN.EXE", AppWinStyle.NormalFocus)
AppActivate(MyAppID) ' Activate VisMfg
'% = Alt and ^ = Ctrl
SendKeys.SendWait(TextBox1.Text)
SendKeys.SendWait(Chr(9)) 'tab
SendKeys.SendWait(TextBox2.Text)
SendKeys.SendWait("%O")
'====
'this is where I need to add the error checking
'====
Exit Sub
ERRRUNNING:
retval = MsgBox("The Manufacturing Window is already open.", MsgBoxStyle.OKOnly, "VM Mfg Win")
AppActivate("Manufacturing Window(tm)") ' Activate VisMfg
SendKeys.SendWait("%F")
SendKeys.SendWait("O")
Resume Next
End Sub

Any insight would be greatfully appreciated. :)

Himo
12-22-2004, 01:33 AM
Unless you add some parameter to be send to your application it isn't possibles since you need to catch the error somewhere.

mcguirepm
12-22-2004, 09:27 AM
Isn't there an API call that would identify a msgbox by it's message. Unfortunately the Error msgbox has the same title as the parent window.

AtmaWeapon
12-22-2004, 11:21 AM
Unless the external application returns some error code, I'm pretty certain that there is no way to tell the specific error that occurs.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum