Jump to content

Command Line for Minimizing


Generic

Recommended Posts

I am looking for a Windows command line that will STOP a window from minimizing.

Here is the issue we are having. In our call centre, our agents are locked down with GPO restrictions. These are compete locked down solutions which also impedes the right click functionality in Windows. One of our applications has a bad habit of minimizing when an agent moves to another program window and we are unable to ‘restore’ the window. Rather than deconstruct our GPO’s and restrictions, which would be a very time consuming endeavor I might add, I am looking for a command line that will stop the application from minimizing.

Something like this:

start "Title: notepad" /max "c:\windows\notepad.exe"

This command maximizes a window on start up. I would need one that impedes this.

Something like this if it existed:

start "Title: notepad" /disableminimize "c:\windows\notepad.exe"

Does that make sense?

Oh, and I can’t use 3rd party utilities for this. This has to be an inherent function of windows.

I am also open to suggestions.

Link to comment
Share on other sites


The only thing i can think of is a registry key that tells all apps to open in full screen. What about a .pif file? .pif files tell programs how to start.

-gosh

Link to comment
Share on other sites

Hmmm that might be a good option. We are also discovering that the application may in fact be 'restoring' but doing so off screen. Do you think this .pif file would correct that as well?

Link to comment
Share on other sites

Well you're in luck. There is a little documented windows registry entry that makes ALL aplications ever opened to be maximized (not fullscreen). I don't know if it fits your requirements perfectly, but I'd say it's pretty close.

REGEDIT4

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer]
"MaximizeApps"=dword:1

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer]
"MaximizeApps"=dword:1

*edit: on second glance, it doesn't prevent them from minimizing. But i think (don't remember any more) that it disables the middle (resize) button.

GL

Edited by GrofLuigi
Link to comment
Share on other sites

None of those will keep it from minimizing though... :)

It's crude...but you can run an AutoIt script in the background that constantly watches the state of the window in question. If it gets minimized then the script would maximize the app again. Try this:

AutoItSetOption("TrayIconHide",1)
AutoItSetOption("WinTitleMatchMode",2)

$X = 0

While $X = 0
Sleep(250)
$state = WinGetState("Notepad","")
If $state = "23" Or $state = "31" Then
WinSetState("Notepad","",@SW_Maximize)
EndIf
WEnd

You can try replacing @SW_Maximize with @SW_Restore to see if it works. Also note that once this application starts it'll run in a constant loop until the user either logs off or it's killed in Task Manager. Normally you could end it via the system tray icon, but the very first line of the example above turns off the system tray icon (so as to keep 'invisible' to your techies so they don't close it). The second line tells AutoIt that any window title matches only have to be partial. So if the window title is "My Great Database - Microsoft Access", you only have to instruct it to look for "My Great Database", or even just "- Microsoft Access". I just used "Notepad" because that's the app I used to test this. :)

Also, whatever you do...do not remove the 250ms sleep. If it's not there then this script will instantly consume half your CPU cycles on a dual core/hyperthreaded system. On a single-core system it'll go to 100%. The sleep gives it enough of a rest that it's not noticeable to the system and will still appear to be near immediate (1/4 of a second).

Link to comment
Share on other sites

yeah, running the app from the server. Running it as a seamless app. I just went down to get a better idea of whats going on. This is the issue that I'm seeing. It seems when the agents use the 'restore down' 'maximize' button (the one in between the X and the _) the application seems to go off screen. Like it's defaulting to a second unknown monitor and the agent can't do anything to bring it back to the first monitor. This is also happening on their desktop appication (that they use when citrix is down) but they can bring that back to the 'main screen'.

Very weird... and it seems that it is only happening sporadically.

Link to comment
Share on other sites

So basically they have to keep it maximized (full screen) the entire time it's running then?

With the application running on the Citrix server you'd have to run that AutoIt script in the background on of their session as well. That basically means changing the program to a script that starts the application and the AutoIt script.

I can make some changes so that if the state is anything but maximized then it'll change it to maximized.

Edited by nmX.Memnoch
Link to comment
Share on other sites

Yeah basicly. It just bothers me that this is happening. Very weird issue that I've never seen before.

Edit. Oh I just wanted to add as well, that if the screen gets minimized at anytime it doesn't come back up. So if the script allows the window to minimize we may have some issues bringing it back up unless we can choose displays.

Edited by Generic
Link to comment
Share on other sites

Try this. @SW_Show will tell it to show the window if it's hidden. The WinMove() line will move the application window to 20 pixels from the top and 20 pixels from the left. @SW_Maximize will then make the application full screen.

AutoItSetOption("TrayIconHide",1)
AutoItSetOption("WinTitleMatchMode",2)

$X = 0

While $X = 0
Sleep(250)
$state = WinGetState("Notepad","")
Select
Case $state = "7"
WinSetState("Notepad","",@SW_Show)
WinMove("Notepad","",20,20)
WinSetState("Notepad","",@SW_Maximize)
Case $state = "15"
WinSetState("Notepad","",@SW_Show)
WinMove("Notepad","",20,20)
WinSetState("Notepad","",@SW_Maximize)
Case $state = "23"
WinSetState("Notepad","",@SW_Show)
WinMove("Notepad","",20,20)
WinSetState("Notepad","",@SW_Maximize)
Case $state = "31"
WinSetState("Notepad","",@SW_Show)
WinMove("Notepad","",20,20)
WinSetState("Notepad","",@SW_Maximize)
EndSelect
WEnd

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...