cancel
Showing results for 
Search instead for 
Did you mean: 

System.Diagnostics.Process.Start and UI 2004

Former Member
0 Kudos

Can anyone tell me if (how) I can use System.Diagnostics.Process.Start to spawn external applications from a trapped item event in my add-on?

My application model is the standard startup/sub main. It looks like this:

Module Startup

Sub Main()

Dim oAV As MyObject

oAV = New MyObject

' Startup

System.Windows.Forms.Application.Run()

End Sub

End Module

MyObject contains a "New()" that sets the SBO_Application object etc. It also contains a few subs that capture events in the sbo UI such as button presses. Now, the trick - how do I set up my threading model correctly to allow me to launch an external application like calculator from within the UI?

Thanks in advance!

Ty Babcox

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Dim ProcID As Integer

' Run Calculator.

ProcID = Shell("C:\Windows\system32\calc.exe", AppWinStyle.NormalFocus)

Seems to work but I was hoping to use .Process.Start

Former Member
0 Kudos

It sounds like you are having a problem becuase you are launching your application (calc.exe in example) under a thread that is then closing. You can use the invoke delegate to launch from the 'parent' thread. You will probably have to make a delegate function and call that with me.invoke(delegate)

Look at 'invoke' in the msdn.