This document is archived and information here might be outdated. Recommended version. |
The handle of the control.
[Visual Basic .NET] Public ReadOnly Property hWnd As Integer
[C#] public int hWnd {get;}
[C++]
HRESULT get_hWnd(
OLE_HANDLE* hWnd
);
[C++]
Parameters hWnd [out, retval]
hWnd is a parameter of type OLE_HANDLE*
When implementing IToolControl to create a custom tool, use the hWnd property to pass window handle of the control to the application.
For example, if you want your ToolControl to be a simple ComboBox control, put a ComboBox control on a form and then pass the hWnd of the ComboBox control to the ToolControl. If you want you ToolControl to be more complex such as a ComboBox with a label, you can put the ComboBox and Label in a Frame control or PictureBox control, and then pass the hWnd of the Frame or PictureBox to the ToolControl.
Only one instance of a ToolControl can exist within an application framework at any give time. This
is because the hWnd property is passed a window handle to the control. To prevent a user from dragging two instances of a ToolControl into an application framework set the ICommand::Category property to an empty string. This will prevent the ToolControl from appearing in the customzie dialog.