Jump to content

WinMove does not work with some apps while does work with some others


inna
 Share

Recommended Posts

Hello,

I'm not sure but it seems weird to me as an absolute newbie.

This is my code:

;#RequireAdmin
$title = WinWait('New Tab', '', 3)
;$title = WinWait('[Title:New Tab - Google Chrome]', '', 3)
;$title = WinWait('Untitled - Notepad', '', 3)
Sleep(1000)
WinActivate($title)
Sleep(1000)
WinSetState($title, '', @SW_MAXIMIZE)
Sleep(1000)
WinMove($title, '', 400, 400, 800, 600)

The issue is: when I want to set $title to Google Chrome, it only works up to  WinSetState and setting Maximize size, but does not change its windows size as stated in WinMove.

But with Notepad, it works fine.

I even tried with RequireAdmin but it doesn't make any differences for Chrome.

I also tried with Edge browser, and got the same result as Chrome.

The exit code is 0 for WinMove which is the failure code.

I also tried these too:

WinMove('click.html', '', 400, 400, 800, 600)

The other thing I faced is: if the window is not maximized or I comment out WinSetState, the WinMove function works fine. Only if the window is not maximized, it works with all Chrome, Edge and Notepad.

Do you please help me? My user is Administrator and there should be no permission in my mind.

I know when I set WinMove then there's not need to set it maximize, but I'm curious if my code is wrong or something else.

Link to comment
Share on other sites

You can try using 

_WinAPI_SetWindowPlacement

Sets the placement of the window for Min, Max, and normal positions

Some windows setting could be causing the behavior you have noticed.

See this microsoft answer: https://answers.microsoft.com/en-us/windows/forum/all/in-win-10-maximized-window-wont-drag/67ba7bce-169c-4c76-865e-586a463cebaa

 

Edited by OJBakker
additional info.
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...