? run code if window is closed/ minimized / restored /maximized / moved / resized

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

Hello,

I am just now converting from the world of DOS. Making simple VB.NET apps
was easier than I expected. Now I need some control over the window that the
app is running in.

Can a VB.NET application run some code when its window is closed/ minimized
/ restored /maximized / moved / resized ? ( and how of cource )

Can a VB.NET app know where it is located in X,Y pixels on the desktop ? (
and run code with every 1 pixel change ? )

Can a VB.NET application know its size as its window gets resized ? ( so I
can run code for every pixel change )

Can a VB.NET know when its window has been selected so it can run some code
?

Can a VB.NET know when its window has been deselected so it can run some
code ?

Thanks
Dan
 
yes on most of your questions (i think all but im not sure) have a look in
the form events (if you double click your form in design time youll get the
form load event, then you can select the right combobox just above your code
to c the other events) you should find a lot of things (gotfocus, resize,
location changed, ....)

i hope this answers your question

eric
 
Hi Dan,

You can find a lot of good information on MSDN and there are a lot of
samples also, so I tell you the maintings (and don't take it all litary, it
is just to bring you on the route).
Can a VB.NET application run some code when its window is closed/ minimized
/ restored /maximized / moved / resized ? ( and how of cource )

A window is the program (or a part of a program or a class, when you come
from dos, call it a module but don't mix it up with a vb module which is
something special).
So when it is closed it can not run. In all other situations you mention it
can run (while I asume you mean with restored, showed again).
Can a VB.NET app know where it is located in X,Y pixels on the desktop ? (
and run code with every 1 pixel change ? )

Yes in every way by drawing, but in that I am also a beginner, but you can
look for "region" and/or "drawing" and/or "painting" on msdn.
Can a VB.NET application know its size as its window gets resized ? ( so I
can run code for every pixel change )

Yes very easy, you can take action in your program when there is an event
called "on resizing"
Can a VB.NET know when its window has been selected so it can run some
code

That can mostly because the window got focus or was resizing or .....but
normaly just because the user did push a button or whatever on the window
(almost endless more possibilities)
Can a VB.NET know when its window has been deselected so it can run some
code ?

The same answer as above.

But this are just a small amount of the posiblities, there are with VB.net
for every problem thousand solutions you can think about..

But don't mix this up with a WindowService, that runs without a form while
getting commands from another program look for that for "remoting" on MSDN.

I hope this bring you on the route?

Cor
 
Back
Top