Application Time Events

Application time (also known as 'Appy time, a play on the words "Happy" and "Application") occurs when the system VM runs in the context of an application. At application time, VxDs can perform any operations that Windows-based applications can. For example, a VxD can load DLLs, link to exported functions, and call the functions.

The system does not automatically notify VxDs when application time occurs. To receive notification, you must use the _SHELL_CallAtAppyTime service to install a callback procedure. The system calls this procedure once and only once when application time next occurs. An arbitrary amount of time may elapse between the call to _SHELL_CallAtAppyTime and a call to the callback procedure. The system does not dispatch application time events while the critical section is held or while the system VM is blocked on any semaphores. There are no guarantees as to the order in which application time events are dispatched.

There are periods of time during which application time is not available, such as during system initialization and system shutdown. Application time may also be momentarily unavailable during the normal operation of the system. You can determine whether application time is available by using the _SHELL_QueryAppyTimeAvailable service. A zero return value means that application time events are not currently available. Even if application time is not available, you can still call _SHELL_CallAtAppyTime. In such cases, the system places the requested event on a queue and does not dispatch the event until application time becomes available. Application time never becomes available if system shutdown is in progress.

Although application time is not available during system initialization, you can still use _SHELL_CallAtAppyTime to request notification as soon as application time is available. This is especially useful for VxDs that need to carry out tasks while the graphical shell starts. For example, an accessibility VxD may use the ShellExecute function during application time to start a screen reader or magnifying glass application. This is important for users who would otherwise find the standard network logon dialog box inaccessible. (The system displays the network logon dialog box before it processes the Startup folder, so placing an accessibility application in the Startup folder does not solve the problem.)

You can cancel an application time event that has not yet been dispatched by using the _SHELL_CancelAppyTimeEvent service. The service requires either the handle of the event as returned by _SHELL_CallAtAppyTime or zero. Attempting to cancel a dispatched event can crash the system. To prevent crashes, most VxDs set the event handle to zero while processing the event. _SHELL_CancelAppyTimeEvent ignores calls in which the handle is zero.

When an application time event is dispatched, the following services are available:

_SHELL_CallDll

_SHELL_FreeLibrary

_SHELL_GetProcAddress

_SHELL_LoadLibrary

_SHELL_LocalAllocEx

_SHELL_LocalFree

These services are similar to the Windows functions having corresponding names. For example, the _SHELL_LoadLibrary service loads the given DLL and returns an instance handle that can be used to dynamically link to exported functions.