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><a href="../../../nn/Overview.html">nn</a>::<a href="../../../nn/applet/Overview.html">applet</a>::<a href="../../../nn/applet/CTR/Overview.html">CTR</a>::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> Again, also check after execution of the <a href="../../../nn/applet/CTR/Enable.html"><CODE>nn::applet::CTR::Enable</CODE></a> function. 33</P><P> 34Do 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. 35</P><PRE> 36Example 37nnMain() 38{ 39 ... 40 while(1) 41 { 42 _exec(); 43 _draw(); 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 does not reach this point. 51 } 52 // Launch library applet after A Button press 53 if ( _pushed_A_button() ) 54 { 55 _start_library_applet(); 56 // Wait for return from library applet 57 applet::WaitForStarting(); 58 // Check for close after control returns 59 if ( <FONT color="red">applet::IsExpectedToCloseApplication()</FONT> ) 60 { 61 _application_finalize(); 62 applet::PrepareToCloseApplication(); 63 applet::CloseApplication(); 64 // Execution does not reach this point. 65 } 66 } 67 ... 68</PRE></div> 69<h2>Revision History</h2> 70 <div class="section"> 71 <dl class="history"> 72 <dt>2010/12/31</dt> 73<dd>Added mention that this must also be called after the <CODE>Enable</CODE> function.<br /> 74 </dd> 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> 85