Notifications
Clear all

[Closed] Maximizing another process from MXS

Yes. Sorry I didn’t test it too much.

SC_MINIMIZE = 0xF020

you can check the state of the window. but i think it’s safe just maximize it (how it was asked originally)

Reviving this thread to ask a somewhat related question: Is there a way to check if max is the currently active windows app? My script is running even if I’m in another app and it would be useful if it had a way of knowing that.

1 Reply
(@polytools3d)
Joined: 11 months ago

Posts: 0
(
 	
 	 fn CreateAssembly =
 	 (
 		 src  = "using System;
"
 		 src += "using System.Runtime.InteropServices;
"
 		 src += "class User32
"
 		 src += "{
"
 		 src += "[DllImport(\"User32.dll\")]
"
 		 src += "public static extern bool SetForegroundWindow(IntPtr hWnd);
"
 		 src += "[DllImport(\"User32.dll\", SetLastError=true)]
"
 		 src += "public static extern IntPtr SetActiveWindow(IntPtr hWnd);
"
 		src += "[DllImport(\"User32.dll\")]
"
 		src += "public static extern IntPtr GetActiveWindow();
"
 		src += "}
"
  
 		 provider = dotnetobject "Microsoft.CSharp.CSharpCodeProvider"
 		 params = dotnetobject "System.CodeDom.Compiler.CompilerParameters"
  
 		 params.GenerateInMemory = true
 		 result = provider.CompileAssemblyFromSource params #(src)
 		 result.CompiledAssembly.CreateInstance "User32"
 	 )
 	 
 	 local assembly
 
 	fn GetActiveWindowHWND =
 	(
 		if assembly == undefined do assembly = CreateAssembly()
 		return (assembly.GetActiveWindow())
 	)
 	
 	try (destroydialog ::RO_TEST) catch()
 	
 	rollout RO_TEST "" width:176 height:72
 	(
 		timer tmr "" interval:1000
 		
 		local maxHWND = windows.getMAXHWND()
 		
 		on tmr tick do
 		(
 			format "maxHWND: % activeHWND: %
" maxHWND (GetActiveWindowHWND())
 		)
 	)
 	
 	createdialog RO_TEST
 	
 )
Page 2 / 2