Spawning php-win.exe as a child process to handle scripting in Windows applications has a few quirks (all having to do with pipes between Windows apps and console apps).To do this in C++:// We will run php.exe as a child process after creating// two pipes and attaching them to stdin and stdout// of the child process// Define sa struct such that child inherits our handlesSECURITY_ATTRIBUTES sa = { sizeof(SECURITY_ATTRIBUTES) };sa.bInheritHandle = TRUE;sa.lpSecurityDescriptor = NULL;// Create the handles for our two pipes (two handles per pipe, one for each end)// We will have one pipe for stdin, and one for stdout, each with a READ and WRITE endHANDLE hStdoutRd, hStdoutWr, hStdinRd, hStdinWr;// Now create the pipes, and make them inheritableCreatePipe (&hStdoutRd, &hStdoutWr, &sa, 0))SetHandleInformation(hStdoutRd, HANDLE_FLAG_INHERIT, 0);CreatePipe (&hStdinRd, &hStdinWr, &sa, 0)SetHandleInformation(hStdinWr, HANDLE_FLAG_INHERIT, 0);// Now we have two pipes, we can create the process// First, fill out the usage structsSTARTUPINFO si = { sizeof(STARTUPINFO) };PROCESS_INFORMATION pi;si.dwFlags = STARTF_USESTDHANDLES;si.hStdOutput = hStdoutWr;si.hStdInput = hStdinRd;// And finally, create the processCreateProcess (NULL, "c:\\php\\php-win.exe", NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi);// Close the handles we aren't usingCloseHandle(hStdoutWr);CloseHandle(hStdinRd);// Now that we have the process running, we can start pushing PHP at itWriteFile(hStdinWr, "<?php echo 'test'; ?>", 9, &dwWritten, NULL);// When we're done writing to stdin, we close that pipeCloseHandle(hStdinWr);// Reading from stdout is only slightly more complicatedint i;std::string processed("");char buf[128];while ( (ReadFile(hStdoutRd, buf, 128, &dwRead, NULL) && (dwRead != 0)) ) { for (i = 0; i < dwRead; i++) processed += buf[i];} // Done reading, so close this handle tooCloseHandle(hStdoutRd);A full implementation (implemented as a C++ class) is available at http://www.stromcode.com