Notifications
Clear all
[Closed] Maximizing another process from MXS
Page 2 / 2
Prev
Oct 23, 2015 2:50 am
you can check the state of the window. but i think it’s safe just maximize it (how it was asked originally)
Oct 23, 2015 2:50 am
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
(
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
Prev