Windows Structure
 
 
 

The Windows struct provides methods to access the Windows OS' User Interface elements.

These methods are available in 3ds Max 2008 and higher.

They were previously available in the Avguard Extensions .

   

windows.getChildrenHWND {<int_HWND>|#max} parent:{<int_HWND>| #max}

This method returns an array of the children windows of the specified HWND, recursively.

If the specified HWND is 0, only the top level desktop windows are returned (not recursively).

If the parent HWND is specified, only windows whose immediate parent is the specified window are returned.

If #max is specified as the HWND, the HWND associated with the 3ds Max main window is used.

If the specified HWND does not exist, the value undefined is returned.

Otherwise, an array is returned.

Each element of the array corresponds to a window, and contains a 5 element array. The elements of these arrays represent the window's

1:HWND

2:parent's HWND

3:ancestor's HWND

4:class name as a string

5:window text as a string

FOR EXAMPLE, A PARTIAL RESULT FROM THE CALL

print (windows.getChildrenHWND #max)

looks like

...
#(330752P, 592998P, 592998P, "#32770", "Main Toolbar")
#(135510P, 330752P, 330752P, "CustToolbar", "")
#(69978P, 135510P, 135510P, "CustButton", "")
#(69980P, 135510P, 135510P, "CustButton", "")
#(69982P, 135510P, 135510P, "CustSeparator", "")
#(69984P, 135510P, 135510P, "CustButton", "")
#(69986P, 135510P, 135510P, "CustButton", "")
#(69988P, 135510P, 135510P, "CustButton", "")
#(69990P, 135510P, 135510P, "CustSeparator", "")
#(69992P, 135510P, 135510P, "ComboBox", "All")
...

In this case, the Main Toolbar of 3ds Max is a docked window which has a HWND of 330752, the 3ds Max main window's HWND is 592998, the class name of the Main Toolbar is "#32770" and the window text of the toolbar is "Main Toolbar".

The next element is the toolbar window is the toolbar itself which has a HWND of 135510 and is parented by the Main Toolbar window with HWND 330752. The class of the toolbar is "CustToolbar" and it does not display any text.

The next element is the Undo Button, first icon in the toolbar. It has a HWND of 69978 and is parented by the custom toolbar with HWND of 135510. Its class is "CustButton" and has no text associated with it.

After the next element with HWND of 69980 representing the Redo button on the Main Toolbar, we have a Separator, then the Link, Unlink and Bind To Spacewarp icons, yet another separator and the Selection Filter with HWND 69992 and class name "ComboBox" which by defaults displays the text "All"&ldots;

windows.getChildHWND {<int_HWND>| #max} <string> parent:{<int_HWND>|#max}

The mehod returns the child window of the specified HWND with the given child window's text. Child windows are recursively searched.

If the specified HWND is 0, only the top level desktop windows are searched (not recursively).

If the parent HWND is specified, only windows whose immediate parent is the specified window are searched.

If #max is specified as the HWND, the HWND associated with 3ds Max main window is used.

If the specified HWND does not exist, the value undefined is returned.

If a child window with the specified text is not found, undefined is returned.

The text comparison is case insensitive.

If a match is found, a 5 element array is returned, where the elements of the array correspond to the following window properties:

1: HWND

2: parent's HWND

3: ancestor's HWND

4:class name as a string

5: window text as a string

FOR EXAMPLE, A PARTIAL RESULT FROM THE CALL

max file xref object -- open xref object dialog
xro_hwnd = windows.getChildHWND 0 "XRef Objects" parent:#max -- find xref object dialog
if xro_hwnd != undefined do windows.sendMessage xro_hwnd[1] 0x0010 0 0 -- if found, send close message
max file xref scene -- open xref sceen dialog
xrs_hwnd = windows.getChildHWND 0 "XRef Scenes" parent:#max -- find xref scene dialog
if xrs_hwnd != undefineddowindows.sendMessage xrs_hwnd[1] 0x0010 0 0 -- if found, send close message

LISTENER OUTPUT:

OK
#(1117532P, 65556P, 592998P, "#32770", "XRef Objects")
1
OK
#(1183068P, 65556P, 592998P, "#32770", "XRef Scenes")
1
windows.getMAXHWND()

This method returns the HWND of the main 3ds Max window as an integer.

   

windows.getDesktopHWND()

This method returns the HWND of the MS Window's desktop as an integer.

   

See Also