Author Topic: cant find command panel HWND in max 2018 SP3  (Read 3009 times)

2018-03-05, 09:15:10

Christa Noel

  • Active Users
  • **
  • Posts: 911
  • God bless us everyone
    • View Profile
    • dionch.studio
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.

2018-03-05, 11:06:20
Reply #1

Frood

  • Active Users
  • **
  • Posts: 1922
    • View Profile
    • Rakete GmbH
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


Never underestimate the power of a well placed level one spell.

2018-03-06, 06:52:58
Reply #2

Christa Noel

  • Active Users
  • **
  • Posts: 911
  • God bless us everyone
    • View Profile
    • dionch.studio
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.

2018-03-06, 13:47:39
Reply #3

mike288

  • Former Corona Team Member
  • Active Users
  • **
  • Posts: 353
  • Michal 'Mike' Wirth
    • View Profile
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.
Chaos Scatter developer | In case of crash, please send minidump | Private uploader: https://corona-renderer.com/upload

2018-03-07, 10:24:09
Reply #4

Christa Noel

  • Active Users
  • **
  • Posts: 911
  • God bless us everyone
    • View Profile
    • dionch.studio
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())

2018-03-07, 11:11:06
Reply #5

mike288

  • Former Corona Team Member
  • Active Users
  • **
  • Posts: 353
  • Michal 'Mike' Wirth
    • View Profile
just wanted to say that it probably did not change between 2018.0 and 2018.4
Chaos Scatter developer | In case of crash, please send minidump | Private uploader: https://corona-renderer.com/upload

2018-03-08, 03:07:54
Reply #6

Christa Noel

  • Active Users
  • **
  • Posts: 911
  • God bless us everyone
    • View Profile
    • dionch.studio
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

2018-03-09, 10:55:52
Reply #7

Christa Noel

  • Active Users
  • **
  • Posts: 911
  • God bless us everyone
    • View Profile
    • dionch.studio
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