Flex3 / Air 2: NativeProcess doesn't accepts standard input data (Error #2044 & #3218)

Posted by Edward on Stack Overflow See other posts from Stack Overflow or by Edward
Published on 2010-05-04T06:06:37Z Indexed on 2010/05/12 23:54 UTC
Read the original article Hit count: 545

Filed under:
|
|

Hi:

I'm trying to open cmd.exe on a new process and pass some code to programatically eject a device; but when trying to do this all I get is:

"Error #2044: Unhandled IOErrorEvent:. text=Error #3218: Error while writing data to NativeProcess.standardInput."

Here's my code:

    private var NP:NativeProcess = new NativeProcess();

    private function EjectDevice():void
    {
             var RunDLL:File = new File("C:\\Windows\\System32\\cmd.exe");
             var NPI:NativeProcessStartupInfo = new NativeProcessStartupInfo();
             NPI.executable = RunDLL;
             NP.start(NPI);
             NP.addEventListener(Event.STANDARD_OUTPUT_CLOSE, CatchOutput, false, 0, true);
             NP.standardInput.writeUTFBytes("start C:\\Windows\\System32\\rundll32.exe shell32.dll,Control_RunDLL hotplug.dll");
             NP.closeInput();
    }

I also tried with writeUTF instead of writeUTFBytes, but I still get the error. Does anyone have an idea of what I'm doing wrong?.

Thanks for your time :) Edward.

© Stack Overflow or respective owner

Related posts about flex

Related posts about air