54494 - Stdin in console apps on Windows still does not work on Windows

Feedback Case Number: 54494

54494 - Stdin in console apps on Windows still does not work on Windows now 4 years later.

Bug is archived.

  1. Please reopen it.
  2. How can this be ?? Xojo is selling Console as feature, and what are you supposed to do with Console apps if StdIn does not work ?


So what exactly is supposed to be the process for the “Swept under the carpet bugs” that were marked as Archived ?.

This one for example is.

As far as I know there is nothing in Feedback to help me get it back to open state (I think ??’)

And posting here seems to do nothing at all, at least my post was 100% ignored and the issue is still archived.

PS. On this bug then you lost customer and had to refund at least one license back then, and I lost a customer as well since I was not quick enough to port it for them to C# when it was clear this was completely broken in Xojo. And your about to loose another now since I cannot help them ! All those years, and this bug has not even been looked at. And it makes Console applications more or less useless unless your doing something very limited with them that only takes parameters and nothing else.

You can request that a case be re-opened just click on the status and choose reopen.


I logged 59101 two years ago as stdin.ReadAll did not work on MS-Windows.

Anyone else found a workaround for this, I have the same issue?

I can’t find the bug in the bug tracker, and stdin appears to be working when I test it. That said, for Windows you can use declares to create a BinaryStream to read from:

Public Function Win32StdIn() As BinaryStream
  Declare Function GetStdHandle Lib "Kernel32" (HandleType As Integer) As Integer
  Declare Function DuplicateHandle Lib "Kernel32" (SourceProcessHandle As Integer, _
   SourceHandle As Integer, TargetProcessHandle As Integer, ByRef TargetHandle As Integer, _
   DesiredAccess As Integer, InheritHandle As Boolean, Options As Integer) As Boolean
  Const STD_INPUT_HANDLE = -10
  Const DUPLICATE_SAME_ACCESS = &h00000002
  Dim handle As Integer = GetStdHandle(STD_INPUT_HANDLE)
  Dim dup As Integer
  If DuplicateHandle(-1, handle, -1, dup, 0, False, DUPLICATE_SAME_ACCESS) Then 
    Dim bs As New BinaryStream(dup, BinaryStream.HandleTypeWin32Handle)
    Return bs
  End If
End Function

Dim stream As BinaryStream = Win32StdIn()
Dim s As String = stream.Read(1024)

Here it is.
(Sidenote, when searching for cases by number, enter your search term including “#”. In this case, search for “#54494”)


@kevin_g , I’ve been following that issue too. I’ve just posted a sample of what I think may be a solution so feel free to check it out on the issues page

This code does indeed work.

It would be great if Xojo would apply this code internally to fix the bug instead of letting the bug lay around for few more years for no good reason. Now they even got the above code to see how it needs to be so things work.

1 Like

It has been nominated for BugBash, there are :+1: but it is not assigned :disappointed:.

1 Like