Jump to content

Windows 7 Minimize external app problem


martin
 Share

Recommended Posts

I want to programmatically minimze a window, or at least move it out of the way in Windows 7. There is only one user and there is no password.

By hand I can do both.

If I use Winlist I can see the window but WinSetState has no effect. I can of course move the mouse to the minimize icon with MouseMove but then clicking using MouseClick('left') has no effect.

Winmove has no effect either.

None of the controls on the window, and no mouse click coordinates show using the AutoIto info Tool.

To add to my confusion, or to put it another way, to expose my lack of understanding here, if I run the script with #requiresadmin, then winlist does not find any windows.

The window is started by a task I wrote with full Admin priveleges. I have tried running the script the same way but that's no help.

If I control the PC remotely then I can click the minimize button and the window minimizes fine.

Can anyone explain this and, even better, tell me what I should be doing?

The same thing in XP works ok for me.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

try once more.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • Moderators

Hi, Martin. Is this some specific application window in Windows? The code below works for me all day long on XP and Win7:

For IE

WinSetState("Google - ", "", @SW_MINIMIZE)

For Notepad

WinSetState("[CLASS:Notepad]", "", @SW_MINIMIZE)

And for Excel

WinSetState("[CLASS:XLMAIN]", "", @SW_MINIMIZE)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Thanks for your reply JLogan3o13. Yes, for most applications in W7 WinSetState works fine.

In my post I did say that WinSetState has no efffect in W7 on the window I want to minimize. No problems in XP. Winmove doesn't work either in W7.

The window I am trying to close is a TeamViewer window. I can use WinSetState successfully on other windows in W7 but not theTeamViewer one. It surprised me that a simulated click on the minimze button doesn't work.

But also I don't understand why WInList returns no windows if I run the script with #RequireAdmin.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • Moderators

Hi, Martin. Ok, that helps knowing the window type. As for why WinList is not returning anything, I'm not sure - will have to look into that some more. Out of curiosity, which version of TeamViewer are you using? I use both 6 and 7, and have tried the following on Windows 7, which works for me.

WinSetState("[CLASS:TV_CClientWindowClass]", "", @SW_MINIMIZE)

Are you trying to minimize a TV window when you're remote controlling someone else, or when you're remoting into an unattended machine?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

I'm still using TV version 5.

I'll try your method

WinSetState("[CLASS:TV_CClientWindowClass]", "", @SW_MINIMIZE)

But where did you get that class name? I'm using QuickSupport for my customer's installation and the class name is #32770 according to the AutoIt inspection tool.

If it works I'll be very pleased. I've tried using the title as returned by WinGetTitle and I've tried using the handle but not the class.

I have a program on a remote machine where the customer wants remote support occasionally. When the program starts it starts up Teamviewer but it tends to start with a window in the middle of the screen and in front of my program and the customer doesn't like it. Nor do I.

I think there are more options I could use if I upgraded to version 6 but at the moment the cost isn't justified.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • Moderators

Hi, Martin. Hope it works for you. I just downloaded v5, and confirmed it works on that version for me as well.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

No, has no effect. But then I wasn't optimistic because I imagine that AutoIt uses the Class name to get the window handle

The window I'm trying to minimize is the QuickSupport customized window. I'm not sure if you can get those without having a paid-for version.

The only thing I hav ebeen able to do is to WinActivate successfully, but WInMove, WInSetState are ignored. MouseMove to the Caption bar of the window follwed by clicking, mousedown etc has no effect in Windows 7.

In fact if I Winactivate the window then Mousemove stops working. They must use some lower level hooks to stop people like me.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • Moderators

Hi, Martin. I have the Pro version of 7 (which allows me all the previous versions) for my HelpDesk guys. I also use the custom QuickSupport with our logo. What do you see when you use the window info tool on the window, anything at all under Class?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Hi, Martin. I have the Pro version of 7 (which allows me all the previous versions) for my HelpDesk guys. I also use the custom QuickSupport with our logo. What do you see when you use the window info tool on the window, anything at all under Class?

Yes, I see

CLASS:#32770

but using that calss name doesn't help me.

I'll send you a PM with a link so you can download the QUickSupport my customers use then you can see what I mean.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I don't whether that is an valid option, but you can try to send Windows+D and then activate your application.

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

  • Moderators

Hi, Martin. This window definitely resists any kind of commands. I tried with your customized QuickSupport, as well as just the normal QuickSupport, and couldn't get either to do much of anything. Thus far, the only thing I have gotten to work is Xenobiologist's suggestion to send a "#d", but that minimizes everything. As you stated, this works just fine in XP, not sure why it is so different in Win7.

Still banging my head against this wall, but so far no joy.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Never mind, I feel better that you find the same problem.

Stop banging your head on the wall - it doesn't do the wall any good and it annoys the neighbours. Don't worry about it any more because I'm saying that if my customer wants support he simply has to start the TV app. I've given him a menu option to do that and I've stopped starting TV when my app starts. It will have to wait untill I get TV 6.

Thanks for your trouble JLogan3o13.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I don't whether that is an valid option, but you can try to send Windows+D and then activate your application.

Yes, I hadn't thought of that. When TV starts my app has'nt show its main window and my app is the only app that needs to be shown. So I can start TV, minimize everything then let my app appear.

Thanks Xenobiologist, that is an obvious solution that was out of my sight.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

This one is working for me on Win7 x64:

#include <WinAPIEx.au3>
$pid = ProcessExists("Teamviewer.exe")
If Not $pid Then Exit MsgBox(16, "Error", "Teamviewer.exe not found!", 10)
$aRes = _WinAPI_EnumProcessWindows($pid)
$hWnd = $aRes[1][0]
WinSetState($hWnd, "",@SW_MINIMIZE)

WinAPIEx.au3 needed!

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

This one is working for me on Win7 x64:

#include <WinAPIEx.au3>
$pid = ProcessExists("Teamviewer.exe")
If Not $pid Then Exit MsgBox(16, "Error", "Teamviewer.exe not found!", 10)
$aRes = _WinAPI_EnumProcessWindows($pid)
$hWnd = $aRes[1][0]
WinSetState($hWnd, "",@SW_MINIMIZE)

WinAPIEx.au3 needed!

Br,

UEZ

Thanks for the attempt Uez. I tried your code but it has no effect on my TeamViewer on W7 64bit or 32 bit. Since I have already tried using WInSetState using the window handle and failed I wasn't very hopeful, but you never know.

See post #12, it must be that your TeamViwer is not like mine.

Br

martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • Moderators

Hi, Martin. I just wanted to add some additional info in trying to figure this thing out. I tried it on my Win 7 x64 box, with the customized download you PM'd me, and it is working. Seems like a machine-specific issue now...

Edit: BTW, very nice UEZ. Small script but it taught me a lot.

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Thanks for the attempt Uez. I tried your code but it has no effect on my TeamViewer on W7 64bit or 32 bit. Since I have already tried using WInSetState using the window handle and failed I wasn't very hopeful, but you never know.

See post #12, it must be that your TeamViwer is not like mine.

Br

martin

Current version of my TV is 7.0.12189 Portable.

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

  • 6 months later...

Ok I am not using windows 7 but rather windows XPe on a Neoware E100 ThinClient whos sole purpose is a MagicJack PC, however I like to remote in from Time to Time to see logs of callers and such... so i am trying to use TeamViewer and am having issues. There is a monitor only connected to this PC so that we can see who is calling and if there are voicemails and such. The issue is that when I remote in and check everything is fine but then when I end the session the TeamViewer nag screen pops up and the main Teamviewer Window pops up. I am using the latest version of TeamViewer 7.0.13989 and the latest version of AutoIt.

Here is my code for the Pop Up Nag Screen

Local $tvHandle = 0
while True
  $tvHandle = WinWaitActive("Sponsored session")
  if Not ($tvHandle = 0) Then
   Send("{Enter}")
  EndIf
WEnd

I compiled it into an exe which seams to work for the nag screen, however I can't seem to minimize or better yet close the TeamViewer window but leave it in the windows tray. I have tried several methods with Autoit from information I have found in these forums. I even started my own thread however the only answer someone gave me was to use Remote Desktop, the problem is when I use Remote Desktop and end my session it logs out of windows which caused the MagicJack not to work then I dont have Phone service.

So I can't seem to close the TeamViewer window on the Client (MagicJack) box when I end my TeamViewer session. So I turned to AutoIt and here is my latest attempt. Now I am getting an error when running the script on line 5.

#include 

$pid = ProcessExists("Teamviewer.exe")

If Not $pid Then WinWaitActive($pid)



WinSetState($pid, "",@SW_HIDE)

I am a total noob, this is my first shot at AutoIt or scripting at all, so please be aware when replying. I have thought about other programs like teamviewer such as LogMeIn but I like the fact that TeamViewer is free for residential and that there is a free android app as well. Any suggestions would be nice. I really like TeamViewer but at this point I need something free theat I can use from my phone and doesnt leave a winddow when I end my session.

Link to comment
Share on other sites

I tested the code from post#15 on my WinXP vm and it works properly. I've no WinXPe to test it.

Might be some differences in WinXPe.

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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
 Share

  • Recently Browsing   0 members

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