Which method is more suitable for closing the form: application. Exit or form. Close?

Source: Internet
Author: User
Reference: http://msdn.microsoft.com/zh-cn/library/aa497275.aspx

Application. Exit is a forced exit method, just like Win32 postquitmessage (). It means to discard all message pumps, expand the call stack, and return the execution to the system.

Disable applications in Windows (Win32 or. NET)ProgramThe correct way is to close its main application window (such as form. Close ). You must manually close any windows that still exist after the master message pump ends. Calling form. Close or form. dispose to close a window before exiting the application is a good practice to clear the window, but you need to do this consciously. We need to remember that the onclosing () of the. NET Framework is wm_close of the Win32 managed version, rather than wm_destroy.

In addition, if you use form. Close (), you can clear the content and close the file of your application by handling the onclosing or onclosed events. If you use application. Exit to forcibly exit the application, these events cannot be called.

Good luck!

--------------------------------------------------

Lee Sen-Listen
E-mail: lisencool@gmail.com

Statement:
Here we focus onWinCEAndWindows MobileSome basic knowledge in development. I would like to share with you, and I hope you will give your comments and contribute to me. I will post your name for you as soon as possible!

Announce:
Here collects general knowledge on WinCE and Windows Mobile. i'm very gglad to share them with all friends, and also hope you can share your problems and opinions and contribute articles to me to share with others. i'll publish your articles and sign your name at the first time.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.