Find motherboard ID with flex builder?

北慕城南 提交于 2020-02-06 12:58:05

问题


I want to get motherboard ID in flex builder. This is my code. I follow this code to build my own Retrieve manufacturer information from device that AIR app is running on

But I got this error TypeError: Error #1009: Cannot access a property or method of a null object reference.

give me some solution please.

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="100%" height="100%" showStatusBar="false" verticalAlign="middle"
name="Login" windowComplete="init()">

<mx:Script>
    <![CDATA[
        import flash.desktop.NativeProcess;
        import flash.desktop.NativeProcessStartupInfo;
        import flash.display.Sprite;
        import flash.events.Event;
        import flash.events.ProgressEvent;
        import flash.filesystem.File;

        private var process:NativeProcess; 


        private function init():void
        {
            var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo(); 
            var file:File = new File("C:/Windows/System32/cmd.exe");

            nativeProcessStartupInfo.executable = file; 

            var processArgs:Vector.<String> = new Vector.<String>(); 

            processArgs.push("wmic baseboard get serialnumber");

            nativeProcessStartupInfo.arguments = processArgs; 
            process.start(nativeProcessStartupInfo);

            process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
            process.exit();
        }

        private function onOutputData(event:ProgressEvent):void
        { 
            var data:String = process.standardOutput.readUTFBytes(process.standardOutput.bytesAvailable); 
            txtreq.text = data;
        }

    ]]>

</mx:Script>
<mx:Panel id="panel1" width="368" height="84" borderAlpha="0.47" dropShadowVisible="true"
          horizontalCenter="-10" layout="absolute" title="Activation" verticalCenter="-10">
    <mx:TextInput id="txtreq" x="10" y="10" width="293" editable="true"/>
</mx:Panel>
</mx:WindowedApplication>

this is error.. http://i.stack.imgur.com/QoTfb.png

来源:https://stackoverflow.com/questions/19607594/find-motherboard-id-with-flex-builder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!