batch command to detect minimize

September 25, 2012 at 21:12:28
Specs: Windows 7, 6GB
hi
there is a program x in my computer which minimizes after i log into it.i want to start another program when this program x has been minimized.not terminated.i dont want to pause and wait or have a time interval.is it possible?

it would be really helpfull.thanks


See More: batch command to detect minimize

Report •

#1
September 26, 2012 at 13:08:26
I guess I would add a command within the initial program right after the minimize effect.

start "another program"

I do not think there is an easier way in batch to accomplish this.
edit: added italics, meant to when originally posting.
:: mike


Report •

#2
September 26, 2012 at 13:47:59
There are ways, but none available to batch. PowerShell gives you access to the Win32 API, and that gives you acces to IsIconic(). But that's PowerShell.

How To Ask Questions The Smart Way


Report •

#3
September 26, 2012 at 19:18:13
Yeah, batch solution using PowerShell.
Don't try to manually parse it; I can't and I wrote it.
Just replace Calculator with your window.
Then add whatever you need after the "&&" on the last line.
set str=Add-Type -MemberDefinition '[DllImport("""user32.dll""")] public static extern IntPtr FindWindow(IntPtr ZeroOnly, string lpWindowName);' -NameSpace """Win32""" -Name """Import"""; ^
Add-Type -MemberDefinition '[DllImport("""user32.dll""")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool IsIconic(IntPtr hWnd);' -NameSpace """Win32""" -Name """Import2"""; ^
exit -not [Win32.Import2]::IsIconic([Win32.Import]::FindWindow(0, """Calculator"""))
powershell -command %str% &&

How To Ask Questions The Smart Way


Report •
Related Solutions


Ask Question