문서 편집 권한이 없습니다. 다음 이유를 확인해주세요:
요청한 명령은 다음 권한을 가진 사용자에게 제한됩니다: 사용자.
== Autoit named pipe 사용예제 == * 명령창에서 실행하는 명령 출력해 주는 함수 * Named Pipe를 사용하는 API를 이용해서 명령프롬프트의 출력 내용을 읽기 <source lang=autoit> #include <NamedPipes.au3> #include <WinAPI.au3> #include <Constants.au3> Func StdOut($sCmd, $sWorkingDir = "", $state = @SW_HIDE) Local $iBytes, $sData, $hReadPipe, $hWritePipe, $tBuffer, $tProcess, $tSecurity, $tStartup Local $STILL_ACTIVE = 0x103 Local Const $STARTF_USESHOWWINDOW = 0x1 Local Const $STARTF_USESTDHANDLES = 0x100 $tSecurity = DllStructCreate($tagSECURITY_ATTRIBUTES) DllStructSetData($tSecurity, "Length", DllStructGetSize($tSecurity)) DllStructSetData($tSecurity, "InheritHandle", True) _NamedPipes_CreatePipe($hReadPipe, $hWritePipe, $tSecurity) $tProcess = DllStructCreate($tagPROCESS_INFORMATION) $tStartup = DllStructCreate($tagSTARTUPINFO) DllStructSetData($tStartup, "Size", DllStructGetSize($tStartup)) DllStructSetData($tStartup, "Flags", BitOR($STARTF_USESTDHANDLES, $STARTF_USESHOWWINDOW)) DllStructSetData($tStartup, "StdOutput", $hWritePipe) DllStructSetData($tStartup, "StdError", $hWritePipe) DllStructSetData($tStartup, "ShowWindow", $state) _WinAPI_CreateProcess("", $sCmd, 0, 0, True, 0, 0, $sWorkingDir, DllStructGetPtr($tStartup), DllStructGetPtr($tProcess)) Local $handle = DllStructGetData($tProcess, "hProcess") _WinAPI_CloseHandle(DllStructGetData($tProcess, "hThread")) Local $kernel = DllOpen("kernel32.dll") _WinAPI_CloseHandle($handle) _WinAPI_CloseHandle($hWritePipe) $tBuffer = DllStructCreate("char Text[4096]") While 1 _WinAPI_ReadFile($hReadPipe, DllStructGetPtr($tBuffer), 4096, $iBytes) If $iBytes = 0 Then ExitLoop $sData &= StringLeft(DllStructGetData($tBuffer, "Text"), $iBytes) WEnd _WinAPI_CloseHandle($hReadPipe) Return $sData EndFunc </source> [[category:autoit]]
문서 저장 미리 보기 차이 보기 취소