def WriteConsoleOutput( hConsoleOutput, buffer, cols, rows,
bufx, bufy, left, top, right, bottom )
if @@m_WriteConsoleOutput == nil
@@m_WriteConsoleOutput = Win32API.new( "kernel32", "WriteConsoleOutput", ['l', 'p', 'l', 'l', 'p'], 'l' )
end
lpBuffer = buffer.flatten.pack('ss' * buffer.length() * 2)
dwBufferSize = (buffer.length() << 16) + 2
dwBufferCoord = (row << 16) + col
lpWriteRegion = [ left, top, right, bottom ].pack('ssss')
@@m_WriteConsoleOutput.call( hConsoleOutput, lpBuffer, dwBufferSize,
dwBufferCoord, lpWriteRegion )
end