static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); if (!TryUpdate()) { Arguments arguments = new Arguments(args); string windowHandleStr = arguments["targetwndhandle"]; string origWndHandleStr = arguments["origwndhandle"]; if (!(string.IsNullOrEmpty(windowHandleStr) || string.IsNullOrEmpty(origWndHandleStr))) { IntPtr targetHandle = new IntPtr(int.Parse(windowHandleStr)); IntPtr origHandle = new IntPtr(int.Parse(origWndHandleStr)); ObjectEditor.Instance.AttachTo(targetHandle, origHandle); } else { HawkeyeTraceListener.StartListening(); Application.EnableVisualStyles(); Form editor = ObjectEditor.Instance.CreateEditor(); Application.Run(editor); } } }
/// <summary> /// Initializes a new instance of the <see cref="ObjectEditor"/> class. /// </summary> private ObjectEditor() { try { Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); Application.ApplicationExit += new EventHandler(Application_ApplicationExit); } catch (Exception) { } HawkeyeTraceListener.StartListening(); }