Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function tries to free up memory for an application. If necessary, the shell closes down other applications by sending WM_CLOSEmessages.

Syntax

BOOL SHCloseApps(
  DWORD 
dwMemSought
);

Parameters

dwMemSought

[in] Specifies, in bytes, the amount of memory to be freed.

Return Value

This function returns TRUE if it is successful and FALSE if it fails.

Remarks

If a large memory allocation fails in your application, call SHCloseAppsand attempt to allocate memory again.

OEM Support Requirements

This function call is handled by OEM code added to the shell's public source code. This is where an OEM either uses the default implementation or modifies it for a specific device.

The Windows Mobile Standard shell sends WM_CLOSE messages if there is less than 128 KB of free memory. The shell does not send WM_CLOSE messages if you ask for more memory than is available. For example, Windows Mobile Standard does not allocate 200 KB of memory if it only has 190 KB free. Instead, the shell displays an Out Of Memorydialog box to the user. There are two ways to deal with the problem. First, allocate memory in small amounts, such as 16 KB so that your application does not run the risk of asking for more memory than is available. Alternatively, call SHCloseApps, which sends WM_CLOSE messages until there is enough memory for the allocation. However, SHCloseAppsdoes not allocate memory to your application; it only frees memory. If a large memory allocation fails in your application, call SHCloseApps. Then, attempt to allocate memory again.

Requirements

Header aygshell.h
Library aygshell.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Pocket PC 2000 and later, Smartphone 2002 and later

See Also

Reference

WM_CLOSE