Check if certain dialog is minimized or not


#1

i just want to get if a certain window is minimized or not with a true false result

(

local _USER32 =
(
src=“using System;”
src += “using System.Runtime.InteropServices;”
src += “class _user32”
src += “{”
src += " [DllImport(“User32.DLL”, EntryPoint=“GetWindowLong”)]"
src += " public static extern Int32 GetWindowLong(Int32 hWnd, Int32 index);"
src += “}”

  csharpProvider = dotnetobject "Microsoft.CSharp.CSharpCodeProvider"
  compilerParams = dotnetobject "System.CodeDom.Compiler.CompilerParameters"
  
  compilerParams.GenerateInMemory = true
  compilerResults = csharpProvider.CompileAssemblyFromSource compilerParams #(src)
  _user32Assembly = compilerResults.CompiledAssembly
  
  _user32Assembly.CreateInstance "_user32"

)

fn getStyle hwnd = (_USER32.GetWindowLong hwnd -16)

(bit.and (getstyle (certain hwnd)) 0x20000000L) != 0
)

i got this to work but is there any simpler method ?

this code originally written by @denisT on this link https://forums.autodesk.com/t5/3ds-max-programming/script-to-minimize-maximise-all-open-dialog-windows/td-p/10234027

tried to simplify it a little but curious if is there any other way


#2

IsIconic
in newer max versions you can use python libs directly from maxscript. Check Executing Python from MAXScript in the mxs reference

( python.import "ctypes" ).windll.user32.IsIconic hwnd

#4

thanks a million works great and fast