Advertisement
Mysoft

Untitled

Jan 20th, 2016
582
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "windows.bi"
  2. #include "crt.bi"
  3.  
  4. dim shared as handle hCon
  5. dim shared as CONSOLE_SCREEN_BUFFER_INFO tConInfo
  6. dim shared as integer ConWid,ConHei
  7.  
  8. hCon = GetStdHandle( STD_OUTPUT_HANDLE )
  9. GetConsoleScreenBufferInfo( hCon , @tConInfo )
  10.  
  11. ConWid = ( tConInfo.srWindow.Right  - tConInfo.srWindow.Left ) + 1
  12. ConHei = ( tConInfo.srWindow.Bottom - tConInfo.srWindow.Top  ) + 1
  13. SetConsoleScreenBufferSize( hCon , type(ConWid , ConHei) )
  14.  
  15. dim as integer BuffWid = 16, BuffHei = 23, iWritten = 0
  16. dim as ushort ptr pwConBuff
  17. pwConBuff = callocate( sizeof(ushort)*BuffWid )
  18.  
  19. dim as double Timing1 = timer
  20. for I as integer = 0 to 2^8-1
  21.  
  22.   for Y as integer = 0 to BuffHei-1
  23.     for X as integer = 0 to BuffWid-1
  24.      
  25.       pwConBuff[X] = asc("A") + ( asc("F") shl 8 )
  26.       WriteConsoleOutputCharacter( hCon , _
  27.       cast(zstring ptr, pwConBuff) , BuffWid*2 , type(1,Y+1) , @iWritten )  
  28.      
  29.     next X
  30.   next Y
  31.  
  32. next I
  33. Timing1 = (timer-Timing1)*1000
  34.  
  35. dim as CHAR_INFO ptr pConBuff
  36. pConBuff = callocate( sizeof(CHAR_INFO)*BuffWid*BuffHei*2 )
  37. memset( pConBuff , &h07 , sizeof(CHAR_INFO)*BuffWid*BuffHei*2 )
  38.  
  39. dim as double Timing2 = timer
  40. for I as integer = 0 to 2^8-1
  41.  
  42.   var pTemp = pConBuff
  43.   for Y as integer = 0 to BuffHei-1
  44.     for X as integer = 0 to BuffWid-1
  45.      
  46.       pTemp[0].Char.UnicodeChar = asc("a")
  47.       pTemp[1].Char.UnicodeChar = asc("f")
  48.      
  49.       pTemp += 2
  50.      
  51.     next X
  52.   next Y
  53.   dim as SMALL_RECT tRect = type( 1 , 1 ,BuffWid*2 + 1 , BuffHei + 1 )
  54.   WriteConsoleOutput( hCon , pConBuff , type(BuffWid*2,BuffHei) , type(0,0) , @tRect )
  55.  
  56. next I
  57. Timing2 = (timer-Timing2)*1000
  58.  
  59. locate 11,35
  60. printf(!"WriteConsoleOutputCharacter = %f ms",Timing1/(2^8))
  61. locate 13,35
  62. printf(!"WriteConsoleOutput = %f ms\r\n",Timing2/(2^8))
  63.  
  64. sleep
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement