PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<vpopmail_set_user_quotaw32api_deftype>
Last updated: Mon, 16 Jul 2012

CXL. W32api 函数库

简介

这是对于 DLL 的通用扩展 API。它最初是用来允许从 PHP 中访问 Win32 API,尽管这样你仍然可以通过它访问其它 DLL。

这个函数支持当前 PHP 标准的类型(string,boolean,float,integer 和 null)以及你使用 w32api_deftype() 函数所自定义的类型。

警告

本扩展模块是实验性的。本模块的行为,包括其函数的名称以及其它任何关于此模块的文档可能会在没有通知的情况下随 PHP 以后的发布而改变。使用本扩展模块风险自担。

需求

这个扩展只能工作在 Windows 系统中。

安装

这些函数作为 PHP 核心的一部分,无需被安装即可使用。

运行时配置

本扩展模块在 php.ini 中未定义任何设置指令。

资源类型

这个扩展定义了一个资源类型,被用作用户自定义类型。这个类型的名称是 "dynaparm"

预定义常量

以下常量由本扩展模块定义,因此只有在本扩展模块被编译到 PHP 中,或者在运行时被动态加载后才有效。

DC_MICROSOFT (integer)

DC_BORLAND (integer)

DC_CALL_CDECL (integer)

DC_CALL_STD (integer)

DC_RETVAL_MATH4 (integer)

DC_RETVAL_MATH8 (integer)

DC_CALL_STD_BO (integer)

DC_CALL_STD_MS (integer)

DC_CALL_STD_M8 (integer)

DC_FLAG_ARGPTR (integer)

这个例子演示如何得到系统持续运行的时间,并把它显示在一个消息对话框中。

例子 1. 得到系统持续运行的时间,并把它显示在消息对话框中

<?php
// Define constants needed, taken from
// Visual Studio/Tools/Winapi/WIN32API.txt
define("MB_OK", 0);

// Load the extension in
dl("php_w32api.dll");

// Register the GetTickCount function from kernel32.dll
w32api_register_function("kernel32.dll",
                        
"GetTickCount",
                        
"long");

// Register the MessageBoxA function from User32.dll
w32api_register_function("User32.dll",
                        
"MessageBoxA",
                        
"long");

// Get uptime information
$ticks = GetTickCount();

// Convert it to a nicely displayable text
$secs  = floor($ticks / 1000);
$mins  = floor($secs / 60);
$hours = floor($mins / 60);

$str = sprintf("You have been using your computer for:".
              
"\r\n %d Milliseconds, or \r\n %d Seconds".
              
"or \r\n %d mins or\r\n %d hours %d mins.",
              
$ticks,
              
$secs,
              
$mins,
              
$hours,
              
$mins - ($hours*60));

// Display a message box with only an OK button and the uptime text
MessageBoxA(NULL,
          
$str,
          
"Uptime Information",
          
MB_OK);
?>
目录
w32api_deftype -- Îª w32api_functions º¯Êý¶¨Ò»¸öÀàÐÍ
w32api_init_dtype --  ´´½¨ÁËÒ»¸öÊý¾ÝÀàÐ͵ÄʵÀý£¬²¢ÇÒ½«º¯Êý´«ÈëµÄÖµÌîÈëÆäÖÐ
w32api_invoke_function -- 带有一个参数的执行一个函数,参数传递在函数名的后面
w32api_register_function -- 从函数库中使用 PHP 注册一个函数 function_name
w32api_set_call_method -- ÉèÖõ÷Óõķ½·¨



<vpopmail_set_user_quotaw32api_deftype>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST