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> 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 45 // Checking for close after each frame 46 if ( <FONT color="red">applet::IsExpectedToCloseApplication()</FONT> ) 47 { 48 _application_finalize(); 49 applet::PrepareToCloseApplication(); 50 applet::CloseApplication(); 51 // Execution doesn't reach this point. 52 } 53 54 // Launch library applet after A Button press 55 if ( _pushed_A_button() ) 56 { 57 _start_library_applet(); 58 59 // Wait for return from library applet 60 applet::WaitForStarting(); 61 62 // Check for close after control returns 63 if ( <FONT color="red">applet::IsExpectedToCloseApplication()</FONT> ) 64 { 65 _application_finalize(); 66 applet::PrepareToCloseApplication(); 67 applet::CloseApplication(); 68 // Execution doesn't reach this point. 69 } 70 } 71 ... 72</PRE></div> 73<h2>Revision History</h2> 74 <div class="section"> 75 <dl class="history"> 76 <dt>2010/12/31</dt> 77<dd>Added mention that this must also be called after the <CODE>Enable</CODE> function.<br /> 78 </dd> 79 <dt>2010/12/10</dt> 80<dd>Removed a clause about closing an application because of the POWER Button. 81 </dd> 82 <dt>2010/11/30</dt> 83<dd>Initial version.<br /> 84 </dd> 85 </dl> 86 </div> 87 <hr><p>CONFIDENTIAL</p></body> 88</html>