Re: Merging C++ code or export DLL files in php application

From: Date: Tue, 22 Oct 2002 15:00:17 +0000
Subject: Re: Merging C++ code or export DLL files in php application
Groups: php.windows 
Request: Send a blank email to php-windows+get-16473@lists.php.net to get a copy of this message
I would suggest writing a command-line interface to your C++ code, then evoke it with either 'system' or 'exec'. If you really want to be lazy, you can check out the w32api extension: http://www.php.net/manual/en/ref.w32api.php You can use it to directly access Microsoft DLLs, register functions, and call them... its an experimental extension tho, so stability is unknown, but it works on my box ;) Here's a sample that ships with the source code to get the uptime, and open a MFC dialog box to display it: <?php define("MB_OK", 0); dl("php_w32api.dll"); w32api_register_function("kernel32.dll",
      "GetTickCount", "long");
w32api_register_function("User32.dll",
      "MessageBoxA", "long");
$ticks = GetTickCount(); $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));
MessageBoxA(NULL, $str, "Uptime Information", MB_OK); ?> -- Brian 'Bex' Huff bex@stellent.com Phone: 952-903-2023 Fax: 952-829-5424 > Well, the story is that I have developed a MFC database application with > MS-Access database and i want to upgrade it. The application has many and > complex modules, written in C++, compiled with Visual C++ 6.0. I want to > rewrite the application in PHP based on MySql database. I don't want to > write the whole application, I want to know if there's a way to merge C++ > code in a PHP application or better to import some DLL functions? > > Any ideas? > > Thanks in advance.

« previous php.windows (#16473) next »