<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >com_message_pump</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PHP 手册" HREF="index.html"><LINK REL="UP" TITLE="COM 和 .Net(Windows)函数" HREF="ref.com.html"><LINK REL="PREVIOUS" TITLE="com_load" HREF="function.com-load.html"><LINK REL="NEXT" TITLE="com_print_typeinfo" HREF="function.com-print-typeinfo.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP 手册</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.com-load.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.com-print-typeinfo.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.com-message-pump" ></A >com_message_pump</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN22224" ></A ><P > (PHP 4 >= 4.2.3, PHP 5)</P >com_message_pump -- Process COM messages, sleeping for up to timeoutms milliseconds </DIV ><DIV CLASS="refsect1" ><A NAME="AEN22227" ></A ><H2 >Description</H2 >bool <B CLASS="methodname" >com_message_pump</B > ( [int timeoutms] )<BR ></BR ><P > This function will sleep for up to <CODE CLASS="parameter" >timeoutms</CODE > milliseconds, or until a message arrives in the queue. If a message or messages arrives before the timeout, they will be dispatched, and the function will return <TT CLASS="constant" ><B >TRUE</B ></TT >. If the timeout occurs and no messages were processed, the return value will be <TT CLASS="constant" ><B >FALSE</B ></TT >. If you do not specify a value for <CODE CLASS="parameter" >timeoutms</CODE >, then 0 will be assumed. A 0 value means that no waiting will be performed; if there are messages pending they will be dispatched as before; if there are no messages pending, the function will return <TT CLASS="constant" ><B >FALSE</B ></TT > immediately without sleeping. </P ><P > The purpose of this function is to route COM calls between apartments and handle various synchronization issues. This allows your script to wait efficiently for events to be triggered, while still handling other events or running other code in the background. You should use it in a loop, as demonstrated by the example in the <A HREF="function.com-event-sink.html" ><B CLASS="function" >com_event_sink()</B ></A > function, until you are finished using event bound COM objects. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.com-load.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >起始页</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.com-print-typeinfo.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >com_load</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.com.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >com_print_typeinfo</TD ></TR ></TABLE ></DIV ></BODY ></HTML >