Notifications
Clear all

[Closed] commandHWND WM_SETREDRAW issue

	WM_SETREDRAW=0xB
	commandHWND = (windows.getChildHWND #max "Command Panel")
	windows.sendmessage commandHWND[1] WM_SETREDRAW 0 0

I used this code to stop the mod panel from updating when doing things like accessing edit poly modifier, etc.

I noticed that on some installations, regardless of the max version, the call

windows.getChildHWND #max "Command Panel"

returns undefined. I’m not sure why. When I disable the command panel on my system, the call still works.
Anyway, when that happens, the script throws a “no ‘get’ function for undefined” exception, which is nasty.

Here is a version that seems to work for everyone, at least max 2010 and higher:

fn stopRedraw=
(
	WM_SETREDRAW=0xB
	commandHWND = (windows.getChildHWND #max "Command Panel")
	if commandHWND != undefined and classOf commandHWND==Array then commandHWND=commandHWND[1]
	else commandHWND = windows.getmaxhwnd()
	if commandHWND !=undefined do windows.sendmessage commandHWND WM_SETREDRAW 0 0
)
fn resumeRedraw=
(
	WM_SETREDRAW=0xB
	commandHWND = (windows.getChildHWND #max "Command Panel")
	if commandHWND != undefined and classOf commandHWND==Array then commandHWND=commandHWND[1]
	else commandHWND = windows.getmaxhwnd()
	if commandHWND !=undefined do windows.sendmessage commandHWND WM_SETREDRAW 1 0
)

4 Replies
1 Reply
(@denist)
Joined: 2 years ago

Posts: 0

are you sure that was an english version of max?

No, I’m not. It’s likely that it wasn’t.

Now I see it. “Command Panel”. Any ideas how to get around that?

Speaking about localized versions of max, I’m going to post a new thread about a ridiculous issue with a japanese version of max and the FFD modifier.

we can find the first child of “Command Panel” by class name: “SysTabControl32”


first_child_hwnd = for i in (windows.getchildrenhwnd #max) where i[4] == "SysTabControl32" do exit with i[1]

after that get its parent (that means “Command Panel”):


command_panel_hwnd = uiaccessor.getparentwindow first_child_hwnd

very good, thank you!

Since we’re discussing that, what’s your opinion on disabling the command panel vs. the whole max window, using windows.getmaxhwnd() ? I didn’t see a difference really.
What I noticed is that with both ways windows get confused sometimes, other application windows getting in the foreground suddenly. But it’s still better than a flickering mod panel.