Notifications
Clear all

[Closed] MAX 2017 – Where is the Command Panel Window?

global MaxSDKAssembly
fn CreateMaxSDKAssembly =
(

source = ""
source += "using System;
"
source += "using Autodesk.Max;
"
source += "public class MaxSDK
"
source += "{
"
source += "	public Object GetGlobal()
"
source += "	{
"
source += "		return Autodesk.Max.GlobalInterface.Instance;
"
source += "	}
"
source += "}
"

	csharpProvider = dotnetobject "Microsoft.CSharp.CSharpCodeProvider"
	compilerParams = dotnetobject "System.CodeDom.Compiler.CompilerParameters"

	compilerParams.ReferencedAssemblies.AddRange #("System.dll", getdir #maxroot + @"Autodesk.Max.dll")

	compilerParams.GenerateInMemory = true
	compilerResults = csharpProvider.CompileAssemblyFromSource compilerParams #(source)
	
	if (compilerResults.Errors.Count > 0 ) then
	(
		errs = stringstream ""
		for i = 0 to (compilerResults.Errors.Count-1) do
		(
			err = compilerResults.Errors.Item[i]
			format "Error:% Line:% Column:% %
" err.ErrorNumber err.Line err.Column err.ErrorText to:errs 
		)
		MessageBox (errs as string) title: "Errors encountered while compiling C# code"
		format "%
" errs
		undefined
	)
	else
	(
		MaxSDKAssembly = compilerResults.CompiledAssembly
		MaxSDKAssembly.CreateInstance "MaxSDK"
	)
)
MaxSDK = CreateMaxSDKAssembly()

gi = MaxSDK.GetGlobal()
gi.COREInterface.CommandPanelRollup.hwnd

run this code on 2016 and 2017.
(it’s an equivalent to the max SDK getting command panel hwnd)

in 2016 it returns the right HWND, but in 2017 it returns ZERO

it’s a big problem as you can guess. Or it’s a big BUG!

MAXScript_interface->GetCommandPanelRollup()->GetHwnd();

this is a SDK way to get the hWnd. it works for every version except 2017

2 Replies

The property is there, the value is wrong, so I vote for a BUG

I would suggest to file a bug report