Close form

P

Phlics

Hi all,

How to know whether the operation system close my form(ALT-F4, system
shutdown) .

Thanks,
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hi,

There's a Closing event on the Form class, as well as a Closed event, as far
as I remember. System shutdown can also be handled by tapping into the
WndProc and handling the appropriate Windows notification
(WM_QUERYENDSESSION if my memory serves me well).
 
M

Michael Giagnocavo [MVP]

I think the Microsoft.Win32 has some managed wrappers for the Session
ending.
-mike
MVP

Dmitriy Lapshin said:
Hi,

There's a Closing event on the Form class, as well as a Closed event, as far
as I remember. System shutdown can also be handled by tapping into the
WndProc and handling the appropriate Windows notification
(WM_QUERYENDSESSION if my memory serves me well).

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Phlics said:
Hi all,

How to know whether the operation system close my form(ALT-F4, system
shutdown) .

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