Share via


SHCloseApps

This function tries to free up memory for a Smartphone application. If necessary, the shell closes down other applications by sending WM_CLOSE messages.

BOOL SHCloseApps( 
  DWORD dwMemSought 
);

Parameters

  • dwMemSought
    Specifies, in bytes, the amount of memory to be freed.

Return Values

TRUE indicates success. FALSE indicates failure.

Remarks

The Smartphone 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, the Smartphone does not allocate 200 KB of memory if it only has 190 KB free. Instead, the shell displays an Out Of Memory dialog 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, SHCloseApps does 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

Pocket PC: Windows Mobile 2000 and later
OS Versions: Windows CE 3.0 and later
Header: aygshell.h
Library: aygshell.lib

Send feedback on this topic to the authors.

© 2005 Microsoft Corporation. All rights reserved.