Re: GetStdHandle .NET



Dragon,
Not sure what your error is about, as strand__sure suggests, can you show
more of your code you are attempting to use.

Rather then use Win32 APIs from .NET, have you considered using the
System.Console class instead? It encapsulates most of the Win32 Console API
functions. With .NET 2.0 (aka VS 2005, aka Whidbey, due out later in 2005.
See http://lab.msdn.microsoft.com/vs2005/ for details) providing even more
support.

You can use Console.OpenStandardOutput in VS 2002 & 2003 to get the standard
output stream. You can use Console.SetOut to set tell Console.Write what
TextWriter (Stream) to use.

Hope this helps
Jay

"Dragon" <no@xxxxxxxxxxx> wrote in message news:d8pre1$csh$1@xxxxxxxxxxxxxx
| 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_HANDLE. 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.dll" (ByVal nStdHandle As _
| Int32) As IntPtr
|
| Any suggestions? Thank you in advance.
|
|
|
|
|


.



Relevant Pages

  • Re: GUI Programming for Beginners. Re: C going to C++
    ... You can get Qt free for Win32, ... > API instead. ... > Qt's licensing is horrible. ... There is nothing in Qt that isn't standard C++. ...
    (comp.lang.cpp)
  • Re: Setting info on Summary tab of the Properties page for a file
    ... Yes, it's standard. ... Use Win32 COM api (NTFS) ...
    (microsoft.public.vb.winapi)
  • Re: More on Shatter
    ... pronouncements that the problem is "inherent to the Win32 API" and "unfixable". ... dozen of these timers active at once. ... Operators of critical servers could leave the filtering ...
    (Vuln-Dev)
  • Re: What can .Net do for me?
    ... >> object-oriented API. ... If you're not writing OOP apps then you'll probably ... WIN32 is here *now*. ... > "If you don't use the Windows API directly then you'll probably never ...
    (borland.public.delphi.non-technical)
  • Re: TDBC documentation, examples, syntax?
    ... This standard is long, ... code, but ISO 9075 contains more than an interface, it defines an SQL ... What I see in the TDBC API is a distinct, ... layer API", this is what we see as we write Tcl programs. ...
    (comp.lang.tcl)