How to get an active window's size (width and height)

K

kimiraikkonen

Hi,
I need to show an active window's (form) size(width and height in
pixels) in message box, however there are some low-level api calls in
user32.dll but i don't know which function returns the correct
information.

What's the correct user32.dll api function (GetWindowPlacement?) and
syntax?

I supposed there would be a class in .NET 2.0 instead of struggling
Windows API.

Thanks.
 
H

Herfried K. Wagner [MVP]

kimiraikkonen said:
I need to show an active window's (form) size(width and height in
pixels) in message box, however there are some low-level api calls in
user32.dll but i don't know which function returns the correct
information.

If you are referring to the application's active window, take a look at
'Form.ActiveForm'.
 
K

kimiraikkonen

If you are referring to the application's active window, take a look at
'Form.ActiveForm'.

Hi Herfried,
Thanks but my aim is to display an other active window's(not my
project's window) size. (there's some classes under me.activeWindow).

For example when my project is minimized as a notification icon, with
a keystroke(eg: ctrl) i should get the name of current active window's
size(eg: Internet Explorer's window size, explorer's window size). I
tried something but when i minimize my project as a notification
window, keystrokes(keydown event) doesn't run.

How can i do this?

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top