How to get the size of an external window

3

In my case, there is an application that runs parallel to a third-party application which I do not have access to the source, I need my program to capture the size of this window to display a form of the same size in the same position.     

asked by anonymous 19.05.2016 / 21:17

1 answer

3

I'll pass the basics for you to implement, first we need to find out what Handle's application:

var
hWindow : THandle;
begin
    hWindow := FindWindow(nil, 'Calculadora');
end;

With this we can get the positions to superimpose your application:

var
Left, Top, Width, Height: Word;
begin
     GetWindowRect(hWindow, R);
     Left := R.Left;
     Top := R.Top;
     Width := R.Right - R.Left;
     Height := R.Bottom - R.Top;
end;

Then move the application to the size of your form:

Windows.MoveWindow(hWindow, Form1.ClientHeight, Form1.ClientWidth, r.right-r.left,r.bottom-r.top, true); 

Try to implement this in your application, and make the necessary changes.

    
29.06.2016 / 22:44