Thursday, June 21, 2007

Using 3dsMax native window as owned parent of Dotnet form

Plan is instead of win32 using dotnet form with 3dsMax SDK. But how can make the dotnet window as owned child of 3dsmax native window (required to behave properly in minimize/maximize or activate/deactivate window cases)? NativeWinodow class under System.Windows.Form namespace can solve the problem. Code snippet I have used...

Interface* Ip = GetCOREInterface();
HWND childHWND = varForm.CreateForm(Ip->GetMAXHWnd());

void WrapForm::CreateForm(HWND ParentHandle)
{
Test::TestForm^ netForm = gcnew Test::TestForm();
netForm->Show(System::Windows::Forms::NativeWindow::FromHandle(
(System::IntPtr)ParentHandle));
}