<HTML ><HEAD ><TITLE >W32api functions</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="Function Reference" HREF="funcref.html"><LINK REL="PREVIOUS" TITLE="vpopmail_set_user_quota" HREF="function.vpopmail-set-user-quota.html"><LINK REL="NEXT" TITLE="w32api_deftype" HREF="function.w32api-deftype.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="reference" 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 Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.vpopmail-set-user-quota.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.w32api-deftype.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="reference" ><A NAME="ref.w32api" ></A ><DIV CLASS="TITLEPAGE" ><H1 CLASS="title" >CV. W32api functions</H1 ><DIV CLASS="PARTINTRO" ><A NAME="AEN95023" ></A ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="w32api.intro" ></A >Introduction</H1 ><P > This extension is a generic extension API to DLLs. This was originally written to allow access to the Win32 API from PHP, although you can also access other functions exported via other DLLs. </P ><P > Currently supported types are generic PHP types (strings, booleans, floats, integers and nulls) and types you define with <A HREF="function.w32api-deftype.html" ><B CLASS="function" >w32api_deftype()</B ></A >. </P ><DIV CLASS="warning" ><P ></P ><TABLE CLASS="warning" BORDER="1" WIDTH="100%" ><TR ><TD ALIGN="CENTER" ><B >Warning</B ></TD ></TR ><TR ><TD ALIGN="LEFT" ><P >This extension is <SPAN CLASS="emphasis" ><I CLASS="emphasis" >EXPERIMENTAL</I ></SPAN >. The behaviour of this extension -- including the names of its functions and anything else documented about this extension -- may change without notice in a future release of PHP. Use this extension at your own risk.</P ></TD ></TR ></TABLE ></DIV ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="w32api.requirements" ></A >Requirements</H1 ><P > This extension will only work on Windows systems. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="w32api.installation" ></A >Installation</H1 ><P >There is no installation needed to use these functions; they are part of the PHP core.</P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="w32api.configuration" ></A >Runtime Configuration</H1 ><P >This extension has no configuration directives defined in <TT CLASS="filename" >php.ini</TT >.</P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="w32api.resources" ></A >Resource Types</H1 ><P > This extension defines one resource type, used for user defined types. The name of this resource is <TT CLASS="literal" >"dynaparm"</TT >. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="w32api.constants" ></A >Predefined Constants</H1 ><P > The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime. </P ><P ></P ><DIV CLASS="variablelist" ><DL ><DT ><TT CLASS="constant" ><B >DC_MICROSOFT</B ></TT > (<A HREF="language.types.integer.html" >integer</A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DC_BORLAND</B ></TT > (<A HREF="language.types.integer.html" >integer</A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DC_CALL_CDECL</B ></TT > (<A HREF="language.types.integer.html" >integer</A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DC_CALL_STD</B ></TT > (<A HREF="language.types.integer.html" >integer</A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DC_RETVAL_MATH4</B ></TT > (<A HREF="language.types.integer.html" >integer</A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DC_RETVAL_MATH8</B ></TT > (<A HREF="language.types.integer.html" >integer</A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DC_CALL_STD_BO</B ></TT > (<A HREF="language.types.integer.html" >integer</A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DC_CALL_STD_MS</B ></TT > (<A HREF="language.types.integer.html" >integer</A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DC_CALL_STD_M8</B ></TT > (<A HREF="language.types.integer.html" >integer</A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DC_FLAG_ARGPTR</B ></TT > (<A HREF="language.types.integer.html" >integer</A >)</DT ><DD ><P > </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="w32api.examples" ></A >Examples</H1 ><P > This example gets the amount of time the system has been running and displays it in a message box. </P ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN95113" ></A ><P ><B >Example 1. Get the uptime and display it in a message box</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" ><?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); ?></PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></DIV ></DIV ><DIV CLASS="TOC" ><DL ><DT ><B >Table of Contents</B ></DT ><DT ><A HREF="function.w32api-deftype.html" >w32api_deftype</A > -- Defines a type for use with other w32api_functions</DT ><DT ><A HREF="function.w32api-init-dtype.html" >w32api_init_dtype</A > -- Creates an instance of the data type typename and fills it with the values passed </DT ><DT ><A HREF="function.w32api-invoke-function.html" >w32api_invoke_function</A > -- Invokes function funcname with the arguments passed after the function name</DT ><DT ><A HREF="function.w32api-register-function.html" >w32api_register_function</A > -- Registers function function_name from library with PHP</DT ><DT ><A HREF="function.w32api-set-call-method.html" >w32api_set_call_method</A > -- Sets the calling method used</DT ></DL ></DIV ></DIV ></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.vpopmail-set-user-quota.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.w32api-deftype.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >vpopmail_set_user_quota</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="funcref.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >w32api_deftype</TD ></TR ></TABLE ></DIV ></BODY ></HTML >