Jump to content

WinActivate doesn't reliably work in Windows 10 SAC, recent cumulative

Go to solution Solved by junkew,

Recommended Posts

We use AutoIt as part of our Windows deployment process, to automate things that are otherwise not automatable. It's very much a last resort; there aren't many things that require it, but one of them is the installation of drivers that are not signed and Windows therefore won't install without popping up a dialogue.

We use WinActivate to activate these windows and send them keystrokes. This has worked without a problem for years. Suddenly, it's not working. It can't activate the named windows, and when asked whether the window is active, it returns 0, indicating that it's not.

If we click on any other window that's running – or the desktop – suddenly it works. (I.e. my activation loop succeeds on the next try.)

The problem appears to happen on SAC, not LTSC, and it appears to have begun with the July or August cumulative.

Not all computers have the problem, but we have been unable to identify anything in common about the ones that do; they span many different models and ages, and sometimes are identical to other machines that don't have the problem.

Has anyone else noticed this inability to activate windows? Any idea where it's coming from or what we can do? Because obviously, we can't activate our way out of the problem.

One more thing I'll mention: watching an affected machine, the main window of our installer process is itself not in the foreground – i.e. not active – when it launches. This is unusual and may be related, as I understand that the underlying API calls may not allow applications to change what's in the foreground unless they themselves are either in the foreground or were launched by something that was in the foreground. But we also don't know why the main window would not have been in the foreground. Nothing else was running! But this may all be a red herring and completely unrelated.


Link to post
Share on other sites
  • Solution

Most likely there is somewhere another modal dialog around (or a 2nd desktop?) that prevents you from activating something else and that modal goes away as when you click the desktop

Hard to say but I would suggest for debugging

* use controlxx functions

* add a winactivate for the desktop to first activate the desktop  (below by using shell application)

$oShell = ObjCreate("Shell.Application")

or probably


* See what winmove is doing with your window

* Use winlist to dump all titles that are on screen

* Loop through winlist items and set them all 1 by 1 active and see whats happening (offcourse for debugging)

* Alternative: Get your window x,y position and move the mouse and click (this assumes its on foreground)


Link to post
Share on other sites

Wow, I had no idea people were replying! Unfortunately I assumed "following" meant that it would email me if there were replies. Anyway, we have tried the mouseclick suggestion and that has done the job, so thanks! I will mark that as the solution.


Link to post
Share on other sites
  • Moderators


If you click on the "Notifications" icon (the bell at top right of the page) you can set how you wish to be notified by the forum.


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Link to post
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...