By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,872 Members | 2,333 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,872 IT Pros & Developers. It's quick & easy.

API Functions

P: 1
hello
in order to using api functions,for example:MessageBoxA,I write following codes(php4.4.2):
**********************************************
dl("php_w32api.dll");
w32api_register_function("user32.dll","MessageBoxA ","long");
MessageBoxA(NULL,"str1","str2",0);
***********************************************
But I accept following error:
*****call to undefined functio:w32api_register_function()********
please guide me.
thanks
Jul 5 '06 #1
Share this Question
Share on Google+
1 Reply


sashi
Expert 100+
P: 1,754
Hi there,

are you calling this function from a Linux web server? try the sample codes below.. it works fine for me.. good luck my fren.. :)

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. // Define constants needed, taken from
  3. // Visual Studio/Tools/Winapi/WIN32API.txt
  4. define("MB_OK", 0);
  5.  
  6. // Load the extension in
  7. dl("php_w32api.dll");
  8.  
  9. // Register the GetTickCount function from kernel32.dll
  10. w32api_register_function("kernel32.dll", 
  11.                          "GetTickCount",
  12.                          "long");
  13.  
  14. // Register the MessageBoxA function from User32.dll
  15. w32api_register_function("User32.dll",
  16.                          "MessageBoxA",
  17.                          "long");
  18.  
  19. // Get uptime information
  20. $ticks = GetTickCount();
  21.  
  22. // Convert it to a nicely displayable text
  23. $secs  = floor($ticks / 1000);
  24. $mins  = floor($secs / 60);
  25. $hours = floor($mins / 60);
  26.  
  27. $str = sprintf("You have been using your computer for:" .
  28.                 "\r\n %d Milliseconds, or \r\n %d Seconds" .
  29.                 "or \r\n %d mins or\r\n %d hours %d mins.",
  30.                 $ticks,
  31.                 $secs,
  32.                 $mins,
  33.                 $hours,
  34.                 $mins - ($hours*60));
  35.  
  36. // Display a message box with only an OK button and the uptime text
  37. MessageBoxA(NULL, 
  38.             $str, 
  39.             "Uptime Information", 
  40.             MB_OK);
  41. ?> 
  42.  
Jul 6 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.