My boss has a windows application that he wrote. It is not a Windows console application, but a Windows GUI application. We, of course, have the source code, but he does not want it to be a console app. He wants it to remain a regular GUI application.
The thing is, he wants to be able to call it from PHP, passing it parameters, and have the application return information to the calling PHP script. I can easily call Windows console applications and read the output. I can even call VBS scripts and get the output from them as well.
But, we are stumped on how to get a regular Windows application to output data to a calling php script without resorting to writing the output to a text file and reading it from within php.
Has anybody been able to do this? If so, how?
Thanks in advance.
Amy
Editing to add: Apparently, the boss put this code in his application:
BOOL bConsole = AllocConsole();
HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD dwCharsWritten = 0;
string sS3Path = sCommandLine.substr(sCommandLine.find("S3://") + 5);
string sMessage = "S3 Path: " + sS3Path;
BOOL bWritten = WriteConsole(hOutput, sMessage.c_str(), sMessage.size(), &dwCharsWritten, NULL);
But, php is not seeing the information that he is writing to this console. We’ve tried exec and shell_exec to no avail.
Our final solution was for my boss to modify his Windows application. He was able to write to the console from within the app, and we could then read the output to that console.
Amy