Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] I need help! => Topic started by: Christa Noel on 2018-03-05, 09:15:10

Title: cant find command panel HWND in max 2018 SP3
Post by: Christa Noel on 2018-03-05, 09:15:10
Hi guys,
i dont have max 2018 and i'm writing a script which need to call commandPanel HWND.
Code: [Select]
windows.getChildHWND #max "Command Panel"]
the code above works in older max version but return undefined in max 2018. Then a friend recommends me to use this string "CommandPanelWindow", i changed it and a user said it works in max 2018 but another user said it doesnt in max 2018.3
so i need your help guys who writes maxscript and use max 2018.3
thanks.
Title: Re: cant find command panel HWND in max 2018 SP3
Post by: Frood on 2018-03-05, 11:06:20
The only "help" I can provide, the Command Panel line from windows.getChildrenHWND #max:

Max2018.4:
#(3935548P, 31197526P, 31197526P, "Qt5QWindowIcon", "CommandPanelWindow", 0P, 31197526P, 31197526P)

Max2016.4:
#(1923704P, 5331588P, 5331588P, "#32770", "Command Panel", 5331588P, 5331588P, 5331588P)

But with that line of code you will not get a handle anyway if the command panel is floating. It's a child of the desktop, not max in this case. I wonder how one is supposed to solve this properly.


Good Luck


Title: Re: cant find command panel HWND in max 2018 SP3
Post by: Christa Noel on 2018-03-06, 06:52:58
thanks frood,
hmm max 2018.4 uses "CommandPanelWindow" too ... thats weird.
about floating command panel, thats a new case for me, thanks again for pointing this out.
Title: Re: cant find command panel HWND in max 2018 SP3
Post by: mike288 on 2018-03-06, 13:47:39
on Max 2018.0 (20.0.0.966) I am getting
#(8196840P, 5379884P, 5379884P, "Qt5QWindowIcon", "CommandPanelWindow", 0P, 5379884P, 5379884P)

Max since 2018 uses more Qt stuff that changes things like that. I suggest to test such things twice: in a pre-2018 Max version and in Max 2018.
Title: Re: cant find command panel HWND in max 2018 SP3
Post by: Christa Noel on 2018-03-07, 10:24:09
hi thanks mike, thats exactly as the same as what the others suggest..
it makes me assume the user uses floating command panel like frood said before which is belong to
Code: [Select]
windows.getChildrenHWND (windows.getDesktopHWND())
Title: Re: cant find command panel HWND in max 2018 SP3
Post by: mike288 on 2018-03-07, 11:11:06
just wanted to say that it probably did not change between 2018.0 and 2018.4
Title: Re: cant find command panel HWND in max 2018 SP3
Post by: Christa Noel on 2018-03-08, 03:07:54
finally it is done :D
the cause was the floating command panel :D . i never thought of floating command panel is useful by some people.
thanks guys
Title: Re: cant find command panel HWND in max 2018 SP3
Post by: Christa Noel on 2018-03-09, 10:55:52
hi guys, here it is final code which i shared yesterday in other forum too http://forums.cgsociety.org/showthread.php?p=8384594#post8384594
Code: [Select]
(    if cui.commandPanelOpen then
    (   local popUpDialogs= UIAccessor.GetPopupDialogs()
        local currentMax= (maxVersion())[1]/1000-2
        local WindowText= "Command Panel"
        local cmdPanelName= if currentMax>=18 then "CommandPanelWindow" else WindowText
        local floatingCmdPanel
        (    for i in PopUpDialogs where
            (    UIAccessor.GetWindowText i == WindowText
            )    while FloatingCmdPanel==undefined do
            (    floatingCmdPanel= i
            )
        )
        local CommandPanelHWND=
        (    if floatingCmdPanel != undefined then
            (    floatingCmdPanel
            )    else
            (    local theHWND= windows.getChildHWND #max cmdPanelName
                theHWND[1]
            )
        )
        if CommandPanelHWND== undefined then CommandPanelHWND= windows.getChildHWND intHWND WindowText --this weird line is needed because in max 18 "CommandPanelWindow" will change to "Command Panel" when we float and dock back the command panel.
        CommandPanelHWND
    )
)
thanks