473,669 Members | 2,504 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Close form

Hi all,

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

Thanks,

Nov 15 '05 #1
2 1132
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_QUERYENDSES SION 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" <ph****@hotmail .com> wrote in message
news:uH******** ******@tk2msftn gp13.phx.gbl...
Hi all,

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

Thanks,


Nov 15 '05 #2
I think the Microsoft.Win32 has some managed wrappers for the Session
ending.
-mike
MVP

"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote
in message news:eI******** ******@TK2MSFTN GP12.phx.gbl...
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_QUERYENDSES SION 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" <ph****@hotmail .com> wrote in message
news:uH******** ******@tk2msftn gp13.phx.gbl...
Hi all,

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

Thanks,

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2736
by: marcelf3 | last post by:
Hello.. This page opens a window with some information, but everytime the user changes a field in the parent window, the child window needs to be closed. These 2 functions were supposed to do the work. Nota() - opens new window. fechaNota() - closes the window opened by Nota() here is the code.
1
2098
by: Jules Winfield | last post by:
My WinForms application can have any number of top level forms open at a given time. If the user selects File|Exit, all of the forms are closed. The loop to close the forms looks something like this: foreach(MyForm form in AllMyForms){ form.Close(); } Application.Exit(); The OnClosing method is overridden in MyForm. If the user has made changes to his form, this method asks him if he'd like to: a) save his changes b) forget changes...
2
4988
by: Chien Lau | last post by:
Hi, At a certain point in my application, I have access to a Form object. I want to close that form: form.Close(); There are any number of reasons why this form might not close. A common reason might be that the user answered "No" when the form's OnClosing() override asked him "Are you sure you want to close this form?"
7
2514
by: Alice | last post by:
Hi, In my program, the user can navigate to many different forms. When they go to the next form, I want the form they have left to close. However, the forms aren't closing. Can anyone tell me what I'm doing wrong? Here is a sample snippet of code where the user can return to the main form while simultaneously closing the previous form.
5
11066
by: Stan Sainte-Rose | last post by:
Hi, Which event is called when the user click on the close window icon (X) ? I want, when he clicks on this icon, to display a message before closing the form. If he replys by No, I don't want to close the form. Thks for your help Stan
6
6645
by: Tom | last post by:
Is there ANY easy way to close a MDI Child form in the middle of it's load? For instance, during the Load event I find a need to close the form (for whatever reason - maybe the user isn't ready for it yet, or it displays another form and they hit cancel). In any event, I need to be able to cause that MDI Child form to close. Just sticking Me.Close in there won't work, generates an error (note however, that on a NON-MDI form this seems to...
5
7435
by: AP | last post by:
IS there a way to run a procedure if the users close access directly rather than closing a menu screen that I have built? There is an event that works on close for this form, but it doesnt seem to run if the form is open and the suer just closes access all together, is there a way around this? Thanks
6
6990
by: scott | last post by:
I guess this is a simple one but I can't seem to get it to work. I want to refresh an open form "onClose" of another. I have a Close button on a form which has User Details on it. If I update the data on that from, I want it to automatically refresh the details which are shown on an open form. I was going to use the default access code DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
3
4420
by: rdemyan via AccessMonster.com | last post by:
I need help with code to close two forms at the same time, FormA and FormB. I need code that can be used from either form and needs to work with both a 'Close' button on each form as well as if the user clicks the 'X' in the control box. I have a function, IsObjectOpen, that can be used to check if a form is open. The function is used as follows: X = IsObjectOpen(FormName,2)
1
3863
by: dan.c.roth | last post by:
oForm.Close() vs this.Close() in a modal dialog. oFrom.Close() calls Form.Dispose() but this.Close() ,say in the click event of the Form, does not. I can think of the reason for this but is this documented and if so can someone give me the reference. And is this true for .net 1 and 2. Thanks
0
8465
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8383
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8895
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8809
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8588
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8658
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2032
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.