Notifications
Clear all

[Closed] .NET SDK unique instance/form

How can I have a unique form with the .NET SDK API, pretty much like the workflow we currently do with Maxscript

try ( destroyDialog(dialog) ) catch()

createDialog dialog

I’ve figured out that by creating the Maxform with an UtilityObj, thus making an unique instance works out, but I wanted to know how to do it without creating an UtilityObj.

Hope this makes sense!

Thanks.

4 Replies

IRollupWindow ?

example c++ usage from uvwunwrap, pelt dialog

void PeltDialog::SetUpDialog(HWND hWnd)
{
	IRollupWindow *irollup = GetIRollup(GetDlgItem(hWnd,IDC_PELTDIALOG_ROLLOUT));
	irollup->AppendRollup(hInstance,MAKEINTRESOURCE(IDD_UNWRAP_PELTROLLUP1_DIALOG),QuickPeltRollupDialogProc, _T(GetString(IDS_PW_QUICK_PELT)),(LPARAM)mod );

	irollup->AppendRollup(hInstance,MAKEINTRESOURCE(IDD_UNWRAP_PELTROLLUP2_DIALOG),PeltOptionsRollupDialogProc, _T(GetString(IDS_PW_PELT_OPTIONS)),(LPARAM)mod );
	irollup->Show(0);
	irollup->Show(1);
	irollup->SetPanelOpen(1,FALSE);
	ReleaseIRollup(irollup);
	this->hWnd = hWnd;
}

if it you don’t need it to use max rollouts then any modeless dialog with the max main window as it’s parent should do the job. You just need to supply the call backs and your good to go.

from the Channelinfo project in the sdk samples (called treeviewutil for some reason…

void CreateNewFloater()
 	{
 	if (floaterHWND == NULL)
 		CreateDialog(
 			hInstance,
 			MAKEINTRESOURCE(IDD_COLORCLIP_FLOATER),
 			GetCOREInterface()->GetMAXHWnd(),
 			ViewChannelsFloaterDlgProc);
 }

where ViewChannelsFloaterDlgProc is your dialog callback.

then close with…

 DestroyWindow(hWnd);

actually I don’t think theres anything stopping you adding a rollouts to these windows.

Thanks man, that seems pretty much it, I’ll let you know how it worked out!

Cheers.

one thing I forgot in the WM_INITDIALOG msg section of the callback you need to register the dialog with max so it recieves messages wi

GetCOREInterface()->RegisterDlgWnd(hWnd);

and when you finished with it in the WM_DESTROY msg

GetCOREInterface()->UnRegisterDlgWnd(hWnd);

where HWnd is the dialogs window handle