1.

Solve : checking if window is minimized?

Answer»

batch newbie power yeahhhhhh

i was wondering if it was possible to check if a window is minimized and run commands accordingly.

for example:

Code: [Select]@echo off
if (CODE OR SOMETHING WOULD GO HERE) (
echo yeah this is minimized
exit
)
i am aware that was an awful batch file example

so anyway, is it possible to check such a thing? maybe through vbscript? because i know %errorlevel% cant solve everything CHECKING windows states requires access to the Windows API and this is not directly available from a batch script or the command line. It is possible using a programming language such as C or Visual Basic; the API function you want is called GetWindowPlacement.

It isn't clear which window you are talking about: do you mean the batch script window itself, or some other window?

Perhaps it might be helpful if you told US what you are trying to do.
If I need to find this sort of stuff out from the command line or in a batch I have used a FREE utility called CMDOW. Feed it the window handle and you get back a line of text like this:

C:\>cmdow 0x01084C /P
0x01084C 3 5636 Res Ina Ena VIS firefox Security news

If that window was minimized the 4th ITEM, "Res" would be "Min"

http://www.commandline.co.uk/cmdow/
Quote from: Salmon Trout on September 08, 2013, 07:00:01 AM

Perhaps it might be helpful if you told us what you are trying to do.

+1

Newbies should learn early on to include the reasons, so that experienced people can figure out the best way to solve a problem from the multitude of ways available.

Otherwise they get an answer that is about as useful as their question. Sorry for the rant - it just happens so often.oh, yeah, sorry. it is the batch window itself i am trying to hide. i may use visual basic for this, as i have basic knowledge of it.Using cmdow.exe, check if own window is not minimized and if not, minimize it

for /f "skip=1 tokens=1,2,3,4" %%A in ('cmdow @ /P') do if not "%%D"=="Min" cmdow @ /MINQuote from: tehjoffy on September 08, 2013, 11:25:57 AM
it is the batch window itself i am trying to hide.

Why?


Discussion

No Comment Found