<div class="content" name="RpcWinStationSendMessage" uuid="a8f4bc60-9748-4bca-b231-df84330b0754"><p>The RpcWinStationSendMessage method displays a message box
on a given <span><a href="c41d3367-04c9-4c93-babf-9b5de834eb29#gt_b416f72e-cf04-4d80-bf93-f5753f3b0998" data-linktype="relative-path">terminal server</a></span>
session and, optionally, waits for a reply. The caller MUST have WINSTATION_MSG
permission for this method to succeed. The method checks whether the caller has
WINSTATION_MSG permission (section <span><a href="4507e852-be3d-45b6-bc47-8ca0b552c94d" data-linktype="relative-path">3.1.1</a></span>) by setting
it as the Access Request mask, and fails if the caller does not have the
permission.<a id="Appendix_A_Target_177"></a><a aria-label="Product behavior note 177" href="7ce7f717-461b-4f18-9829-6690168c7707#Appendix_A_177" data-linktype="relative-path">&lt;177&gt;</a></p><dl>
<dd>
<div><pre> BOOLEAN RpcWinStationSendMessage(
   [in] SERVER_HANDLE hServer,
   [out] DWORD* pResult,
   [in] DWORD LogonId,
   [in, size_is(TitleLength)] PWCHAR pTitle,
   [in, range(0, 1024 )] DWORD TitleLength,
   [in, size_is(MessageLength)] PWCHAR pMessage,
   [in, range(0, 1024 )] DWORD MessageLength,
   [in] DWORD Style,
   [in] DWORD Timeout,
   [out] DWORD* pResponse,
   [in] BOOLEAN DoNotWait
 );
</pre></div>
</dd></dl><p><b>hServer:</b> Handle to the server object. This is
of type <span><a href="49484cdf-2feb-4de9-a588-5d01cf8995dc" data-linktype="relative-path">SERVER_HANDLE</a></span>. The <i>hServer</i>
argument MUST be obtained from a previous call to <span><a href="fd6f339d-f5dd-452c-a9a9-ec753c22a36a" data-linktype="relative-path">RpcWinStationOpenServer</a></span>.</p><p><b>pResult: </b> Failure error code if the call to
RpcWinStationSendMessage failed. If the call was successful, this parameter
MUST be STATUS_SUCCESS (0x00000000).</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>STATUS_SUCCESS 0x00000000</td>
  <td>The call succeeded.</td>
 </tr><tr>
  <td>STATUS_ACCESS_DENIED 0xC0000022</td>
  <td>The caller does not have WINSTATION_MSG permission.</td>
 </tr></tbody></table>
</dd></dl><p><b>LogonId: </b> The session ID of the session on
which to display the message box.</p><p><b>pTitle: </b> Pointer to the title for the message box
to display.</p><p><b>TitleLength: </b> The length, in bytes, of the
title to display.</p><p><b>pMessage: </b> Pointer to the message to display.</p><p><b>MessageLength: </b> The length, in bytes, of the
message to display in the specified session.</p><p><b>Style: </b> Can be any value that the standard MessageBox()
method&#39;s <i>Style</i> parameter takes. For more information, see <span><a href="https://go.microsoft.com/fwlink/?LinkId=93359" data-linktype="external">[MSDN-MSGBOX]</a></span>.</p><p><b>Timeout: </b> The response time-out, in seconds.
If the message box is not responded to in <i>Timeout</i> seconds, a response
code of IDTIMEOUT MUST be returned in <i>pResponse</i> to indicate that the
message box timed out. This time-out value is managed by another system
component which dismisses the message box if no user input is entered during
this interval.</p><p><b>pResponse: </b> The return code from the
MessageBox method. This value will be a standard MessageBox return value. For
more information, see [MSDN-MSGBOX].</p><p><b>DoNotWait: </b> If set to TRUE, do not wait for
the response to the message. On return, if no errors occur in queuing the
message, the <i>pResponse</i> parameter will be set to IDASYNC.</p><dl>
<dd>
<p>If FALSE, wait for a response.</p>
</dd></dl><p><b>Return Values: </b> Returns TRUE if the call
succeeded, or FALSE if the method failed. On failure, <i>pResult</i> indicates
the failure status code.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>0x01 TRUE</td>
  <td>Successful completion.</td>
 </tr><tr>
  <td>0x00 FALSE</td>
  <td>Method call failed.</td>
 </tr></tbody></table>
</dd></dl><p> </p></div>