Posted to tcl by patthoyts at Sun Feb 15 11:01:30 GMT 2009view raw
- # Load up some CLR core sections
- import clr
- clr.AddReference('System')
- clr.AddReference('System.Windows.Forms')
- from System import *
- from System.Reflection import *
- from System.Threading import *
- from System.Windows.Forms import Application
- from time import sleep
- # Create and launch the application on a second thread.
- # This prevents the application from blocking the console.
- #
- def RunCallback():
- global App
- asm = Assembly.LoadFrom('Renishaw Assay Reader.exe')
- asm_type = asm.GetType('D3UserInterface.MainForm')
- App = Activator.CreateInstance(asm_type)
- Application.Run(App)
- def LaunchApp:
- tid = Thread(ThreadStart(RunCallback))
- tid.ApartmentState = ApartmentState.STA
- tid.Start()
- while not App:
- sleep(0.2)
- return tid