请问你的PHP版本是多少?
现在的PHP版本里的w32api.dll已改为如下形式:
int Win32::RegisterFunction(string definition [, int flags])
int Win32::UnregisterFunction(string function_name)
int Win32::RegisterCallback(string definition)
int Win32::DefineType(string definition)
int Win32::GetTypeSize(string type_name)
int Win32::InitType(string TypeName)like this:
<?php$api = new win32;/*
BOOL GetUserName(
LPTSTR lpBuffer, // address of name buffer
LPDWORD nSize // address of size of name buffer
);
Returns the current thread's username
"&" passes argument as "refrence" not as "copy"
*/
$api->registerfunction("long GetUserName (string &a, int &b) From advapi32.dll");/*
DWORD GetTickCount(VOID)
Returns the ms the OS is running
*/
$api->registerfunction("long GetTickCount () From Kernel32.dll");$len = 255; // set the length your variable should have
$name = str_repeat("\0", $len); // prepare an empty string
if ($api->GetUserName($name, $len) == 0)
{
die("failed");
}if (!($time = $api->GetTickCount()))
{
die("failed");
}echo "Username: $name<br>\nSystemtime: $time<br>\n";?>
现在的PHP版本里的w32api.dll已改为如下形式:
int Win32::RegisterFunction(string definition [, int flags])
int Win32::UnregisterFunction(string function_name)
int Win32::RegisterCallback(string definition)
int Win32::DefineType(string definition)
int Win32::GetTypeSize(string type_name)
int Win32::InitType(string TypeName)like this:
<?php$api = new win32;/*
BOOL GetUserName(
LPTSTR lpBuffer, // address of name buffer
LPDWORD nSize // address of size of name buffer
);
Returns the current thread's username
"&" passes argument as "refrence" not as "copy"
*/
$api->registerfunction("long GetUserName (string &a, int &b) From advapi32.dll");/*
DWORD GetTickCount(VOID)
Returns the ms the OS is running
*/
$api->registerfunction("long GetTickCount () From Kernel32.dll");$len = 255; // set the length your variable should have
$name = str_repeat("\0", $len); // prepare an empty string
if ($api->GetUserName($name, $len) == 0)
{
die("failed");
}if (!($time = $api->GetTickCount()))
{
die("failed");
}echo "Username: $name<br>\nSystemtime: $time<br>\n";?>
解决方案 »
- PHP一个简单的问题
- 请教一个列举
- 一个PHP环境下,日期比较的代码问题,应该如何修改?
- 如何取值如?test.php?item_1=asd&item_2=asadsd&item_3=asdas&item_4=ddasd&item_5=asasd
- 5年PHP经验,求职(贵阳、重庆、成都、昆明)&散分
- .class.php文件是什么文件?
- 一个关于insert的问题
- 开帖讨论多语言处理,本地化服务的问题
- 我想用fwrite来生成静态的页面,可怎样处理分页呢??
- 谁能给告诉win98下怎么安装php+mysql+apache
- 怪了,$_GET[],$_POST[],$PHP_SELF 都不能用了,当$_SESSION[]又可以,!!!!
- 怎样在本机(XP)上安装PHP???
$obj = new COM("Junly.Encrypt");
$obj->Encrypt("abc","asdf",0);
?>