<?php error_reporting(2047); @set_time_limit(0); @ob_implicit_flush(true); @ini_set('html_errors', false); if (!extension_loaded('Win32 API')) { trigger_error('The Win32 API extension (php_w32api.dll) is not loaded'); return false; } $win32 = new win32(); assert('!is_null($win32)'); $win32->registerfunction("int UuidCreateSequential (string &uuid) From rpcrt4.dll"); $len = 255; // set the length your variable should have $uuid = str_repeat("", $len); // prepare an empty string $rv = $win32->UuidCreateSequential($uuid, $len); echo "uuid={$uuid}\n"; echo "UuidCreateSequential()={$rv}\n";
return false; } return $output; } } /// \todo test win32 code and remove once it's working if (isset($argv[0]) && basename($argv[0]) == basename(__FILE__)) { error_reporting(2047); @set_time_limit(0); @ob_implicit_flush(true); @ini_set('html_errors', false); if (!extension_loaded('Win32 API')) { trigger_error('The Win32 API extension (php_w32api.dll) is not loaded'); return false; } $win32 = new win32(); assert('!is_null($win32)'); /* // works in 5.0.0b1, 4.3.4 $win32->registerfunction('long GetTickCount() from kernel32.dll'); $rv = $win32->GetTickCount(); echo "GetTickCount()=$rv\n"; // doesn't work in 5.0.0b1, 4.3.4 // $win32->registerfunction("long sndPlaySound (string a, int b) From winmm.dll"); // $rv = $win32->sndPlaySound("ding.wav", 0); // echo "sndPlaySound('ding.wav', 0)=$rv\n"; // doesn't work in 5.0.0b1, works in 4.3.4 $win32->registerfunction("long GetUserName (string &a, int &b) From advapi32.dll"); $len = 255; // set the length your variable should have