Window Handle
Two properties allow access to the handle of the Revit main window:
- Autodesk.Revit.UI.UIApplication.MainWindowHandle
- Autodesk.Revit.UI.UIControlledApplication.MainWindowHandle
This handle should be used when displaying modal dialogs and message windows to insure that they are properly parented. Use these properties instead of System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle, which is not a reliable method for retrieving the main window handle.