MainWindowHandle Property


Get the handle of the Revit main window.

Namespace: Autodesk.Revit.UI
Assembly: RevitAPIUI (in RevitAPIUI.dll) Version: 19.0.0.0 (19.0.0.405)
Since: 2019

Syntax

C#
public virtual IntPtr MainWindowHandle { get; }
Visual Basic
Public Overridable ReadOnly Property MainWindowHandle As IntPtr
	Get
Visual C++
public:
virtual property IntPtr MainWindowHandle {
	IntPtr get ();
}

Remarks

Returns the main window handle of the Revit application. This handle should be used when displaying modal dialogs and message windows to insure that they are properly parented. This property replaces System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle property, which is no longer a reliable method of retrieving the main window handle starting with Revit 2019.

See Also