3ds Max UI freezing during scripts? Disable window ghosting.

So anyone that has had a script do anything that takes more than 3 seconds, or have ever tabbed out of, and back into a max that was working, you know what the window ghosting problem is.

disableWindowGhosting2

When windows things that a program is becoming unresponsive it puts up a white overlay, frosting it out. It will also stop redrawing UI elements . If max is working properly, that can be annoying, because progress bars, listviews, and other elements you would like to see updated, will stop.

In order to solve this problem, we need to tell windows to lighten up, and let max do its thing. Pop this maxscript in your “3ds Max\scripts\Startup\” folder and every time a new Max console starts up, it will execute, and fix your problem.

Here is the file: DisableWindowGhosting.ms

I can’t take credit for this, it was sent to me by Tyson Ibele who I am sure you all know already, but when I asked him about it, he pointed me farther back to a cgtalk thread where users Track and denisT shared the solution.

It is short enough, I’ll include the script here as well.

fn DisableProcessWindowsGhosting =
(
local source = StringStream (“using System.Runtime.InteropServices; public class DisableWindowsGhosting{ [DllImport(\”user32.dll\”)] public static extern bool DisableProcessWindowsGhosting(); }”)

compilerParams = dotnetobject “System.CodeDom.Compiler.CompilerParameters”
compilerParams.ReferencedAssemblies.Add(“System.dll”);
compilerParams.GenerateInMemory = on
csharpProvider = dotnetobject “Microsoft.CSharp.CSharpCodeProvider”
compilerResults = csharpProvider.CompileAssemblyFromSource compilerParams #(source as String)
flush source
close source
if (compilerResults.Errors.Count > 0 ) then
(
local errs = stringstream “”
for i = 0 to (compilerResults.Errors.Count-1) do
(
local err = compilerResults.Errors.Item[i]
format “Error:% Line:% Column:% %\n” err.ErrorNumber err.Line err.Column err.ErrorText to:errs
)
format “%\n” errs
undefined
)
else
(
compilerResults.CompiledAssembly.CreateInstance “DisableWindowsGhosting”
)
)

DisableWindowsGhosting = DisableProcessWindowsGhosting()
DisableWindowsGhosting.DisableProcessWindowsGhosting()

And that’s it.