Option Explicit
Public Declare Function AllocConsole Lib "kernel32 () As" Long
Public Declare Function WriteConsole Lib "kernel32" Alias "WriteConsoleA" (ByVal hConsoleOutput As Long, lpBuffer As Any, ByVal nNumberOfCharsToWrite As Long, lpNumberOfCharsWritten As Long, lpReserved As Any) As Long
Public Declare Function ReadConsole Lib "kernel32" Alias "ReadConsoleA" (ByVal hConsoleInput As Long, lpBuffer As Any, ByVal nNumberOfCharsToRead As Long, lpNumberOfCharsRead As Long, lpReserved As Any) As Long
Sub main ()
Dim As a String * 3
AllocConsole
WriteConsole 11, ByVal "hello_world", 12, 0, 0 'can you tell me why does it have to be fixed is 7 or 11 here
ReadConsole 3, ByVal a, 2, 0, 0 'why fixed here also 3
End Sub
And the GetStdHandle result is the same and that several plant really have what meaning
CodePudding user response:
Reference: http://binaryworld.net/Main/CodeDetail.aspx? CodeId=2200 # copyCodePudding user response:
Check out thisCodePudding user response:
This is not the disadvantages of constant definition,All constant looks is a magic number, cloud mountain fog cover!
CodePudding user response:
Don't understand, you have set a fixed length string not 3 what is itCodePudding user response:
All the magic number in the include \ *. H file is defined,CodePudding user response:
The console screen processing example program and a terminal window screen processing related API use examples, from MSVC20 \ SAMPLES \ win32 \ console \http://download.csdn.net/detail/zhao4zhong1/3461309
CodePudding user response:
Don't understand...CodePudding user response: