name22

Console: StdoutRead OEM to ANSI/Char

Jul 16th, 2013
117
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $iPID = Run(@ComSpec & " /c ping 127.0.0.1",  @ScriptDir, @SW_HIDE, 0x2)
  2.  
  3. While True
  4.     $sOUT = StdoutRead($iPID)
  5.     If @error Then ExitLoop
  6.     If @extended Then
  7.         $sANSI = _OemToChar($sOUT)
  8.         ConsoleWrite($sANSI)
  9.     EndIf
  10. WEnd
  11.  
  12. Func _OemToChar($sOEM_Str)
  13.     $aRet = DllCall("user32.dll", "bool", "OemToChar", "str", $sOEM_Str, "str", "")
  14.  
  15.     If Not @error Then Return $aRet[2]
  16.     Return 0
  17. EndFunc
RAW Paste Data