AscentialTest Support Hub

Notifications

Clear all

Setting bounds (location, size) of an application



4

Posts


2

Users


0

Reactions


21

Views


 AnSt

(@anst)
Active Member

Joined: 6 years ago
Posts: 4

Topic starter
 

Use the Windows-DLL “User32.dll”.

Here is an notepad.exe example:

dll “User32.dll”
bool32 MoveWindow (int32 hWnd, int32 x, int32 y, int32 nWidth, int32 nHeight, bool32 bRepaint)

class Helper
static void setBounds(Integer x, Integer y, Integer witdht, Integer height)
Integer hWnd = NotepadObject.GetAttr(“WinHandle”)
MoveWindow(hWnd, x, y, width, height, true)



   

Quote

(@rochtourigny)
Eminent Member

Joined: 6 years ago
Posts: 13

 

I do not understand how to define this as a reusable step.
I currently do some mouse manipulation using UA.GenmouseEvent, but at times, the windows are partially off screen boundaries and my steps fails.
Using your method seems to force the window to appear at a specific position using a specific size, that would be great if I could use this in a step.

Can you please provide more details on definition?



   

ReplyQuote


 AnSt

(@anst)
Active Member

Joined: 6 years ago
Posts: 4

Topic starter
 

May be this helps:

dll “user32.dll”
bool32 MoveWindow (int32 hWnd, int32 x, int32 y, int32 nWidth, int32 nHeight, bool32 bRepaint)

class SetBounds : Step
parameter AppObject application
parameter Integer x
parameter Integer y
parameter Integer width
parameter Integer height
Main()
// In two steps -> e.g. two monitors with different DPI
MoveWindow(application.@WinHandle, x, y, 100, 100, true)
MoveWindow(application.@WinHandle, x, y, width, height, true)



   

ReplyQuote

(@rochtourigny)
Eminent Member

Joined: 6 years ago
Posts: 13

 

It works just fine, Thank you very much!

For those who are not used to work in Zee like me, here is how i finally got it to work, it may not be the preferred method.
1-in the ‘Explorer’ window, right click the ‘Project Library’, select from the contextual menu: ‘add a new zee file’ and give it a significant name.
2-double click the new file, it will open in the Library TAB
3- type in the code, use Alt-Right arrow to indent the lines, if you use spaces, there are going to be errors
( copy and paste do not work, but may be it could be fixed by replacing spaces with Alt-Right Arrow, I did not try. )
4) use Ctrl-S to save

Voila! , if there are no complile error you have a new reusable step. 😀



   

ReplyQuote

Share:

Can’t Find An Answer in the Forum?

Contact Our Team