mirror of
https://github.com/php/php-src.git
synced 2025-01-15 16:24:37 +08:00
e04d6ca9f7
rather than longs. - Make the IDispatch implementation a bit more generic (and fix my mess of pointers). - Add new com_message_pump() function that acts like an interruptible usleep() that processes COM calls/events. - Add new com_print_typeinfo() function for "decompiling" the typeinfo for an interface into PHP script. This is useful for generating a skeleton for use as an event sink. - Add new com_event_sink() function for sinking events from COM objects. Usage is like this: <?php class IEEventSinker { var $terminated = false; function ProgressChange($progress, $progressmax) { echo "Download progress: $progress / $progressmax\n"; } function DocumentComplete(&$dom, $url) { echo "Document $url complete\n"; } function OnQuit() { echo "Quit!\n"; $this->terminated = true; } } $ie = new COM("InternetExplorer.Application"); $sink =& new IEEventSinker(); com_event_sink($ie, $sink, "DWebBrowserEvents2"); $ie->Visible = true; $ie->Navigate("http://www.php.net"); while(!$sink->terminated) { com_message_pump(4000); } $ie = null; ?>
33 lines
854 B
C
33 lines
854 B
C
#ifndef VARIANT_H
|
|
#define VARIANT_H
|
|
|
|
#if PHP_WIN32
|
|
|
|
#define ALLOC_VARIANT(v) (v) = (VARIANT *) emalloc(sizeof(VARIANT)); \
|
|
VariantInit(v);
|
|
|
|
#define FREE_VARIANT(v) VariantClear(v); \
|
|
efree(v);
|
|
|
|
|
|
#define IS_VARIANT php_VARIANT_get_le_variant()
|
|
|
|
#define ZVAL_VARIANT(z, v) if (V_VT(v) == VT_DISPATCH) { \
|
|
comval *obj; \
|
|
ALLOC_COM(obj); \
|
|
php_COM_set(obj, &V_DISPATCH(v), TRUE TSRMLS_CC); \
|
|
ZVAL_RESOURCE((z), zend_list_insert(obj, IS_COM)); \
|
|
} else { \
|
|
php_variant_to_pval((v), (z), codepage TSRMLS_CC); \
|
|
FREE_VARIANT(v); \
|
|
}
|
|
|
|
#define RETVAL_VARIANT(v) ZVAL_VARIANT(return_value, (v));
|
|
#define RETURN_VARIANT(v) RETVAL_VARIANT(v) \
|
|
return;
|
|
|
|
|
|
#endif /* PHP_WIN32 */
|
|
|
|
#endif /* VARIANT_H */
|