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>IsActive</title>
8  </head>
9  <body>
10<h1><CODE>nn::applet::CTR::IsActive</CODE> Function</h1>
11<h2>Syntax</h2>
12    <div class="section">
13      <pre class="definition">
14bool IsActive(
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">Returns <CODE>true</CODE> in the active state and <CODE>false</CODE> otherwise. </div>
25<h2>Description</h2>
26    <div class="section">
27<p>Determines whether an Applet is currently running.</p><!-- write here --><P>
28An Applet is considered to be active when it is running; it is considered to be inactive when it has been interrupted by a call to a library applet or when control has moved to the HOME Menu.
29</P><P>
30Consequently, the return value is <CODE>true</CODE> when called from an application, as the application must be active to be able to call this function in the first place.
31</P><P>
32However, this function can also be called by various callbacks such as the sleep query callback, in which case the application will not be active. You can even use this function within that callback to determine whether an application is currently running.
33</P><PRE>
34  Example
35  // Sleep query callback
36  AppletQueryReply mySleepQueryCallback(uptr arg)
37  {
38      if ( <FONT color="red">applet::IsActive()</FONT> )
39      {
40         return applet::REPLY_LATER;
41      }
42      return applet::REPLY_ACCEPT;
43  }
44</PRE><P>
45In the example above, the function returns <CODE>REPLY_LATER</CODE> handle processing in the main routine when a sleep query arrives with the application active. If the application is not active and is waiting for control to return from another applet, the function returns <CODE>REPLY_ACCEPT</CODE> since the application is ready for sleep mode at anytime.
46</P></div>
47<h2>Revision History</h2>
48    <div class="section">
49      <dl class="history">
50        <dt>2010/12/01</dt>
51<dd>Added an example.<br />
52        </dd>
53        <dt>2010/11/10</dt>
54<dd>Initial version.<br />
55        </dd>
56      </dl>
57    </div>
58  <hr><p>CONFIDENTIAL</p></body>
59</html>
60