Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window.Move not working #267

Closed
ataliady opened this issue Oct 12, 2019 · 4 comments
Closed

Window.Move not working #267

ataliady opened this issue Oct 12, 2019 · 4 comments

Comments

@ataliady
Copy link

        var app = Application.LaunchStoreApp("Microsoft.WindowsCalculator_8wekyb3d8bbwe!App");
        var automation = new UIA3Automation();
        var window = app.GetMainWindow(automation);
        window.Move(0, 0);

Calculator is successfully launched. I try to relocate the app window but the window.Move() just does nothing. Doesn't raise any error/exception either.

What am i missing?

@Roemer
Copy link
Member

Roemer commented Oct 31, 2019

Windows store apps are a bit special.
Like in the calculator, the container window that can be moved is actually the parent of the main window.
The following should work:

var app = Application.LaunchStoreApp("Microsoft.WindowsCalculator_8wekyb3d8bbwe!App");
var automation = new UIA3Automation();
var window = app.GetMainWindow(automation).Parent.AsWindow();
window.Move(0, 0);

@ataliady
Copy link
Author

ataliady commented Nov 2, 2019

Tried it, it worked for a few runs, but then i got the following issue:
Window parent = window.Parent.AsWindow();
While 'window.Parent' equals x, 'parent' is assigned as x.Parent (which in this case is desktop).

windowParent

parent

How can this be?
It's not constant though; sometimes 'parent' is assigned as desktop, and sometimes as calculator. Can't figure out how to deal with this.

@Roemer
Copy link
Member

Roemer commented Nov 6, 2019

That is kind of strange. In the second case, would it work if you take the window instead of the parent?
So maybe first try to get the parent and if the parent is the desktop, do not use the parent, otherwise use the parent.
I know that WindowsStoreApps are quite special as they are usually running in (at least) one host process so it is not easy to get the correct process where the UI window resides.

@Roemer
Copy link
Member

Roemer commented Apr 8, 2021

Closed due to no answer. Feel free to re-open if it is still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants