Hello all,
I ran into trouble with GetStdHandle API. When I'm trying to get standard
output with GetStdHandle(-11I), it returns strange values such as 1548,
1876. If I try to WriteConsole() into these handles, it does not work, and
GetLastError returns ERROR_INVALID_H ANDLE. But when I CloseHandle() them, it
succeeds! I tested this in VC++ and VBA, and GetStdHandle(-11) always
returns 7, which is valid. There is the same problem with standard error,
but no problems with standard input.
I declare GetStdHandle as follows:
Declare Function GetStdHandle Lib "kernel32.d ll" (ByVal nStdHandle As _
Int32) As IntPtr
Any suggestions? Thank you in advance.
I ran into trouble with GetStdHandle API. When I'm trying to get standard
output with GetStdHandle(-11I), it returns strange values such as 1548,
1876. If I try to WriteConsole() into these handles, it does not work, and
GetLastError returns ERROR_INVALID_H ANDLE. But when I CloseHandle() them, it
succeeds! I tested this in VC++ and VBA, and GetStdHandle(-11) always
returns 7, which is valid. There is the same problem with standard error,
but no problems with standard input.
I declare GetStdHandle as follows:
Declare Function GetStdHandle Lib "kernel32.d ll" (ByVal nStdHandle As _
Int32) As IntPtr
Any suggestions? Thank you in advance.
Comment