1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <meta http-equiv="Content-Style-Type" content="text/css" /> 6 <link rel="stylesheet" href="../../../css/manpage.css" type="text/css" /> 7<title>IsExpectedToCloseApplication</title> 8 </head> 9 <body> 10<h1><CODE>nn::applet::CTR::IsExpectedToCloseApplication</CODE> Function</h1> 11<h2>Syntax</h2> 12 <div class="section"> 13 <pre class="definition"> 14bool IsExpectedToCloseApplication( 15 void 16); 17</pre> 18 </div> 19<h2>Arguments</h2> 20 <div class="section"> 21<p>None.</p> 22 </div> 23<h2>Return Values</h2> 24<div class="section"><CODE>true</CODE> indicates that the application should be closed and <CODE>false</CODE> indicates that the application does not need to be closed. </div> 25<h2>Description</h2> 26 <div class="section"> 27<p>Determines whether an application should be closed.</p><!-- write here --><P> 28A return value of <CODE>true</CODE> indicates that the shutdown process has started because there was a close request or for some other reason. In this case, close the application immediately. 29</P><P> 30A return value of <CODE>false</CODE> indicates that the application does not need to be closed. In this case, do nothing. 31<P /> 32Call this function periodically (usually every frame). <FONT color="red">You must also check immediately after returning from a function that is waiting on <CODE>WaitForStarting</CODE>.</FONT></P><P> 33Do this before calling any of the other check functions in the APPLET library (<a href="../../../nn/applet/CTR/IsExpectedToProcessHomeButton.html"><CODE>nn::applet::CTR::IsExpectedToProcessHomeButton</CODE></a>, <a href="../../../nn/applet/CTR/IsExpectedToProcessPowerButton.html"><CODE>nn::applet::CTR::IsExpectedToProcessPowerButton</CODE></a>, and <a href="../../../nn/applet/CTR/IsExpectedToReplySleepQuery.html"><CODE>nn::applet::CTR::IsExpectedToReplySleepQuery</CODE></a>) once control has returned from the waiting state. 34</P><PRE> 35Example 36nnMain() 37{ 38 ... 39 while(1) 40 { 41 _exec(); 42 _draw(); 43 44 // Checking for close after each frame 45 if ( <FONT color="red">applet::IsExpectedToCloseApplication()</FONT> ) 46 { 47 _application_finalize(); 48 applet::PrepareToCloseApplication(); 49 applet::CloseApplication(); 50 // Execution doesn't reach this point. 51 } 52 53 // Launch library applet after A Button press 54 if ( _pushed_A_button() ) 55 { 56 _start_library_applet(); 57 58 // Wait for return from library applet 59 applet::WaitForStarting(); 60 61 // Check for close after control returns 62 if ( <FONT color="red">applet::IsExpectedToCloseApplication()</FONT> ) 63 { 64 _application_finalize(); 65 applet::PrepareToCloseApplication(); 66 applet::CloseApplication(); 67 // Execution doesn't reach this point. 68 } 69 } 70 ... 71</PRE></div> 72<h2>Revision History</h2> 73 <div class="section"> 74 <dl class="history"> 75 <dt>2010/12/10</dt> 76<dd>Removed a clause about closing an application because of the POWER Button. 77 </dd> 78 <dt>2010/11/30</dt> 79<dd>Initial version.<br /> 80 </dd> 81 </dl> 82 </div> 83 <hr><p>CONFIDENTIAL</p></body> 84</html>