<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.win32service.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.win32-get-last-control-message.php',
    1 => 'win32_get_last_control_message',
    2 => 'Returns the last control message that was sent to this service',
  ),
  'up' => 
  array (
    0 => 'ref.win32service.php',
    1 => 'win32service Functions',
  ),
  'prev' => 
  array (
    0 => 'function.win32-delete-service.php',
    1 => 'win32_delete_service',
  ),
  'next' => 
  array (
    0 => 'function.win32-get-service-env-vars.php',
    1 => 'win32_get_service_env_vars',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/win32service/functions/win32-get-last-control-message.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.win32-get-last-control-message" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">win32_get_last_control_message</h1>
  <p class="verinfo">(PECL win32service &gt;=0.1.0)</p><p class="refpurpose"><span class="refname">win32_get_last_control_message</span> &mdash; <span class="dc-title">Returns the last control message that was sent to this service</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.win32-get-last-control-message-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>win32_get_last_control_message</strong></span>(): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

  
  <p class="para rdfs-comment">
   Returns the control code that was last sent to this service process.
   When running as a service you should periodically check this to determine if
   your service needs to stop running.
  </p>
  
  <div class="caution"><strong class="caution">Caution</strong>
   <p class="para">
    Since version 0.2.0, this function work only in &quot;cli&quot; SAPI. On other SAPI 
    this function is disabled.
   </p>
  </div>
  
 </div>


 <div class="refsect1 parameters" id="refsect1-function.win32-get-last-control-message-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">This function has no parameters.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.win32-get-last-control-message-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns a control constant which will be one of the
   <a href="win32service.constants.php#win32service.constants.servicecontrol" class="link">Win32Service Service Control Message Constants</a>:
   <strong><code><a href="win32service.constants.php#constant.win32-service-control-continue">WIN32_SERVICE_CONTROL_CONTINUE</a></code></strong>,
   <strong><code><a href="win32service.constants.php#constant.win32-service-control-deviceevent">WIN32_SERVICE_CONTROL_DEVICEEVENT</a></code></strong>,
   <strong><code><a href="win32service.constants.php#constant.win32-service-control-hardwareprofilechange">WIN32_SERVICE_CONTROL_HARDWAREPROFILECHANGE</a></code></strong>,
   <strong><code><a href="win32service.constants.php#constant.win32-service-control-interrogate">WIN32_SERVICE_CONTROL_INTERROGATE</a></code></strong>,
   <strong><code><a href="win32service.constants.php#constant.win32-service-control-netbindadd">WIN32_SERVICE_CONTROL_NETBINDADD</a></code></strong>,
   <strong><code><a href="win32service.constants.php#constant.win32-service-control-netbinddisable">WIN32_SERVICE_CONTROL_NETBINDDISABLE</a></code></strong>,
   <strong><code><a href="win32service.constants.php#constant.win32-service-control-netbindenable">WIN32_SERVICE_CONTROL_NETBINDENABLE</a></code></strong>,
   <strong><code><a href="win32service.constants.php#constant.win32-service-control-netbindremove">WIN32_SERVICE_CONTROL_NETBINDREMOVE</a></code></strong>,
   <strong><code><a href="win32service.constants.php#constant.win32-service-control-paramchange">WIN32_SERVICE_CONTROL_PARAMCHANGE</a></code></strong>,
   <strong><code><a href="win32service.constants.php#constant.win32-service-control-pause">WIN32_SERVICE_CONTROL_PAUSE</a></code></strong>,
   <strong><code><a href="win32service.constants.php#constant.win32-service-control-powerevent">WIN32_SERVICE_CONTROL_POWEREVENT</a></code></strong>,
   <strong><code><a href="win32service.constants.php#constant.win32-service-control-preshutdown">WIN32_SERVICE_CONTROL_PRESHUTDOWN</a></code></strong>,
   <strong><code><a href="win32service.constants.php#constant.win32-service-control-sessionchange">WIN32_SERVICE_CONTROL_SESSIONCHANGE</a></code></strong>,
   <strong><code><a href="win32service.constants.php#constant.win32-service-control-shutdown">WIN32_SERVICE_CONTROL_SHUTDOWN</a></code></strong>,
   <strong><code><a href="win32service.constants.php#constant.win32-service-control-stop">WIN32_SERVICE_CONTROL_STOP</a></code></strong>.
  </p>
  <p class="para">
   If the value is between 128 and 255, the control code is custom.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.win32-get-last-control-message-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="para">
   Prior to version 1.0.0, if the SAPI is not <code class="literal">&quot;cli&quot;</code>, this function emits an 
<strong><code><a href="errorfunc.constants.php#constant.e-error">E_ERROR</a></code></strong> level error.
  </p>
   <p class="para">
    As of version 1.0.0, will throw a 
    <span class="classname"><a href="class.win32serviceexception.php" class="classname">Win32ServiceException</a></span> if SAPI is not 
    <code class="literal">&quot;cli&quot;</code>
   </p>
 </div>

 
 <div class="refsect1 changelog" id="refsect1-function.win32-get-last-control-message-changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>PECL win32service 1.0.0</td>
       <td>
        Throws a <span class="classname"><a href="class.valueerror.php" class="classname">ValueError</a></span> on invalid data in parameters,
        previously <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> was returned.
       </td>
      </tr>

      <tr>
       <td>PECL win32service 1.0.0</td>
       <td>
        Throws a <span class="classname"><a href="class.win32serviceexception.php" class="classname">Win32ServiceException</a></span> on error,
        previously a 
        <a href="win32service.constants.php#win32service.constants.errors" class="link">Win32 Error Code</a>
        was returned.
       </td>
      </tr>

      <tr>
       <td>PECL win32service 0.2.0</td>
       <td>
        This function works only in the <code class="literal">&quot;cli&quot;</code> SAPI.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>

 
 <div class="refsect1 seealso" id="refsect1-function.win32-get-last-control-message-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.win32-start-service-ctrl-dispatcher.php" class="function" rel="rdfs-seeAlso">win32_start_service_ctrl_dispatcher()</a> - Registers the script with the SCM, so that it can act as the service with the given name</span></li>
    <li><span class="function"><a href="function.win32-set-service-status.php" class="function" rel="rdfs-seeAlso">win32_set_service_status()</a> - Update the service status</span></li>
    <li><span class="function"><a href="function.win32-set-service-exit-mode.php" class="function" rel="rdfs-seeAlso">win32_set_service_exit_mode()</a> - Define or return the exit mode for the current running service</span></li>
    <li><span class="function"><a href="function.win32-set-service-exit-code.php" class="function" rel="rdfs-seeAlso">win32_set_service_exit_code()</a> - Define or return the exit code for the current running service</span></li>
    <li><a href="win32service.constants.php#win32service.constants.servicecontrol" class="link">Win32Service Service Control Message Constants</a></li>
   </ul>
  </p>
 </div>

 
</div><?php manual_footer($setup); ?>