Methods


The following table describes the Application class’s most useful methods.

Open table as spreadsheet

Method

Purpose

AddMessageFilter

Adds a message filter to monitor the event loop’s Windows messages. See the following text for an example.

DoEvents

Processes Windows messages that are currently in the message queue. If the thread is performing a long calculation, it would normally prevent the rest of the thread from taking action (such as processing these messages). Calling DoEvents lets the user interface catch up with the user’s actions. Note that you can often avoid the need for DoEvents if you perform the long task on a separate thread.

Exit

Ends the whole application. This is a rather abrupt halt, and any forms do not execute their FormClosing or FormClosed event handlers, so be sure the application has executed any necessary clean-up code before calling Application.Exit.

ExitThread

Ends the current thread. This is a rather abrupt halt, and any forms on the thread do not execute their FormClosing or FormClosed event handlers.

OnThreadException

Raises the Application object’s ThreadException event, passing it an exception. If your application throws an uncaught exception in the IDE, the IDE halts. That makes it hard to test Application .ThreadException event handlers. You can call OnThreadException to invoke the event handler.

RemoveMessageFilter

Removes a message filter.

Run

Runs a message loop for the current thread. If you pass this method a form object, it displays the form and processes its messages until the form closes.

SetSuspendState

Makes the system suspend operation or hibernate. When the system hibernates, it writes its memory contents to disk. When you restart the system, it resumes with its previous desktop and applications running. When the system suspends operation, it enters low-power mode. It can resume more quickly than a hibernated system, but memory contents are not saved, so they will be lost if the computer loses power.




Visual Basic 2005 with  .NET 3.0 Programmer's Reference
Visual Basic 2005 with .NET 3.0 Programmer's Reference
ISBN: 470137053
EAN: N/A
Year: 2007
Pages: 417

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net