Re: basic console app without .net, is it possible in c#.



"Arne Vajhøj" <arne@xxxxxxxxxx> wrote in message news:47a53135$0$90272$14726298@xxxxxxxxxxxxxxxxxx
Willy Denoyette [MVP] wrote:
"Arne Vajhøj" <arne@xxxxxxxxxx> wrote in message news:47a3d994$0$90270$14726298@xxxxxxxxxxxxxxxxxx
Willy Denoyette [MVP] wrote:
Anyways, there is no real way to build *console* applications in VB6.

Depends on your definition of real.

Use of FSO and link /edit /subsystem:console can
actually produce a console app.

Well, you are cheating :-), but this is not exactly my definition of a console application.
My definition of a console application:
- does not depend on a GDI, that is, creates no Window and (obviously) does not pump a Windows message queue.
- takes his user input from the keyboard (stdin) and sends it's output to a command shell window (stdout).

I don't think that VB6 can create such an application, flipping the console bit in the PE header doesn't help to achieve the above, isn't it?

FSO and flipping the bit help.

Sub Main()
Dim fso As Scripting.FileSystemObject
Dim instm As Scripting.TextStream
Dim outstm As Scripting.TextStream
Dim s As String
Set fso = New Scripting.FileSystemObject
Set instm = fso.GetStandardStream(0)
Set outstm = fso.GetStandardStream(1)
outstm.Write "Enter something: "
s = instm.ReadLine
outstm.WriteLine "You entered: " & s
End Sub

sure quacks like a duck.

Arne



I know that flipping the bit, enables the stdin/stdout in the process, so you can redirect both handles to whatever you see fit. The problem is that you can't get rid of the Form (the Window and it's message queue), or do you have found a means to call Main before the window gets created?

Willy.

.



Relevant Pages

  • Re: vb6 run from and output to command window
    ... VB doesn't really create true console applications (because the linker ... allocate the console window, and read/write from/to it. ... Private Declare Function AllocConsole Lib "kernel32" As Long ... Dim lResult As Long ...
    (microsoft.public.vb.general.discussion)
  • Re: basic console app without .net, is it possible in c#.
    ... actually produce a console app. ... does not depend on a GDI, that is, creates no Window and does not pump a Windows message queue. ... Dim fso As Scripting.FileSystemObject ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: basic console app without .net, is it possible in c#.
    ... actually produce a console app. ... does not depend on a GDI, that is, creates no Window and does not pump a Windows message queue. ... Dim fso As Scripting.FileSystemObject ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: vb6 run from and output to command window
    ... this allows it to inherit a previous console ... window, and means that the explicit AllocConsole/FreeConsole calls are not ... >> Dim lResult As Long ... >> Function ConsoleWriteLn(sOutput As String) As Boolean ...
    (microsoft.public.vb.general.discussion)
  • Re: basic console app without .net, is it possible in c#.
    ... actually produce a console app. ... does not depend on a GDI, that is, creates no Window and does not pump a Windows message queue. ... Dim fso As Scripting.FileSystemObject ...
    (microsoft.public.dotnet.languages.csharp)

Loading