473,473 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

need to write a simple app with console output and file i/o to be distributed
to other machines. Is it possbile in c# without .net overhead, not sure if
all machines Xp have .net installed.

probably suggest c/c++, which version.

any suggestions greatly appreciated.

--
soler
Feb 1 '08 #1
13 2823
On Fri, 01 Feb 2008 09:30:02 -0800, soler
<so***@discussions.microsoft.comwrote:
need to write a simple app with console output and file i/o to be
distributed
to other machines. Is it possbile in c# without .net overhead, not sure
if
all machines Xp have .net installed.
AFAIK, C# only works in the context of .NET. I don't think you can write
an unmanaged program in C#, as the language specifically depends on the
..NET runtime.
probably suggest c/c++, which version.
Any version of C/C++ should work fine. Windows doesn't care what version
of the compiler you used. You do need an SDK that supports the Windows
APIs you intend to use, but if your application is truly simple, you could
probably use an obsolete SDK as well. But why would you? At worst, just
use the latest Visual Studio Express version.

Pete
Feb 1 '08 #2
"soler" <so***@discussions.microsoft.comwrote in message
news:15**********************************@microsof t.com...
need to write a simple app with console output and file i/o to be
distributed
to other machines. Is it possbile in c# without .net overhead, not sure if
all machines Xp have .net installed.

probably suggest c/c++, which version.

any suggestions greatly appreciated.

--
soler

No, you can't run managed code (C#, vb, C++/CLI etc) without the runtime
installed.
Your only option is using an unmanaged language (C/C++, VB6, Delphi etc).
Not sure what your requirements are, but for simple console applications you
can even use a scripting language (VBScript, JScript, Perl etc...)

Willy.

Feb 1 '08 #3
soler wrote:
need to write a simple app with console output and file i/o to be distributed
to other machines. Is it possbile in c# without .net overhead, not sure if
all machines Xp have .net installed.

probably suggest c/c++, which version.
Not possible with C# without .NET - you can use latest and
greatest MS VC++ to generate native code.

But do you really need to ? PC'es without .NET is an
endangered species. And you are allowed to redistribute
the runtime.

Arne
Feb 2 '08 #4
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.

Arne
Feb 2 '08 #5
"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:47***********************@news.sunsite.dk...
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.

Arne

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?

Willy.

Feb 2 '08 #6
Rene wrote:
If that is the case, I don't think VB6 (or Delphi) will work for this
purpose since I am pretty sure that VB6 executables require having
the VB runtime framework to work.
But Delphi (for Win32) executables don't require any runtime to be
present. It is perfectly possible to write single-file applications,
and not only for the console.
--
Rudy Velthuis http://rvelthuis.de

"I have seen the future and it is just like the present, only
longer." -- Albran
Feb 2 '08 #7
"Rudy Velthuis" <ne********@rvelthuis.dewrote in message
news:xn****************@news.microsoft.com...
Rene wrote:
>If that is the case, I don't think VB6 (or Delphi) will work for this
purpose since I am pretty sure that VB6 executables require having
the VB runtime framework to work.

But Delphi (for Win32) executables don't require any runtime to be
present. It is perfectly possible to write single-file applications,
and not only for the console.
--
Rudy Velthuis http://rvelthuis.de

"I have seen the future and it is just like the present, only
longer." -- Albran

The same is true for VB6.

Willy.

Feb 2 '08 #8
Not possible with C# without .NET - you can use latest and
greatest MS VC++ to generate native code.

But do you really need to ? PC'es without .NET is an
endangered species. And you are allowed to redistribute
the runtime.
Tell a potential customer with hundreds, or even thousands, of locked down
PCs to install the .NET framework and you've probably just lost a pretty
significant sale.
Feb 2 '08 #9
Willy Denoyette [MVP] wrote:
"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:47***********************@news.sunsite.dk...
>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
Feb 3 '08 #10
Homer J. Simpson wrote:
>But do you really need to ? PC'es without .NET is an
endangered species. And you are allowed to redistribute
the runtime.

Tell a potential customer with hundreds, or even thousands, of locked down
PCs to install the .NET framework and you've probably just lost a pretty
significant sale.
There can be good reasons to go for native Win32.

My point is that today the logic should be "go with
..NET unless you are absolutely sure that you
need Win32" not "go with Win32 unless you are
absolutely sure that you need .NET".

The percentage of Windows machines with .NET installed
is increasing every day and will continue doing so.

Arne
Feb 3 '08 #11
"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:47***********************@news.sunsite.dk...
Willy Denoyette [MVP] wrote:
>"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:47***********************@news.sunsite.dk. ..
>>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.

Feb 3 '08 #12
Willy Denoyette [MVP] wrote:
"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:47***********************@news.sunsite.dk...
>Willy Denoyette [MVP] wrote:
>>"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:47***********************@news.sunsite.dk.. .
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.

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?
There is no visible window. I delete the form and change project
startup to Sub Main before building.

I don't know what is going on behind the scene. But from what
is visible it looks like a console app.

Arne
Feb 3 '08 #13
"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:47***********************@news.sunsite.dk...
Willy Denoyette [MVP] wrote:
>"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:47***********************@news.sunsite.dk. ..
>>Willy Denoyette [MVP] wrote:
"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:47***********************@news.sunsite.dk. ..
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.

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?

There is no visible window. I delete the form and change project
startup to Sub Main before building.

I don't know what is going on behind the scene. But from what
is visible it looks like a console app.
Well, "under the covers", the VB6 RT initializes it's main thread to enter
an STA, and creates a Top Window and a child Window. This is great, you can
create an instance of FSO (a COM component) to run in an STA, However, the
problem with this is that the code in Main runs before you enter the message
loop, which means that you are effectively blocking the message loop. No big
deal I would say, after all you are a "console application", but be careful
with what you do with COM or you may deadlock (an STA thread must pump the
message queue!).

Willy.

Feb 3 '08 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Lee David | last post by:
I went to the sun site and downloaded what I hope is the development part of java. I downloaded JDK5 with Netbeans. I installed it and now have a folder in my program group "Netbeans". Is that...
5
by: Barry Mossman | last post by:
Hi, can I detect whether my class is running within the context of a Console application, vs say a WinForm's application ? also does anyone know whether the compiler or runtime is smart enough...
6
by: Erez Shor | last post by:
Hi, I need to build and asp page which access a remote windows server's registry and create a registry key. In order for the ASP page to be able to access the registry on the remote server I need...
1
by: Scott Haner via DotNetMonster.com | last post by:
Hey; I've done a decent amount of VB.net in University, but the next stage for a major project we have been asked to use 'modulization' and that the judges want to see as much code and functions...
4
by: ano | last post by:
I have a console application and a lot of Console.WriteLine(). Now I want to convert it to Windows Form Application. Is it possible to getting all of the console messages to Form.Textbox without...
28
by: grappletech | last post by:
I took Pascal and BASIC in a couple of beginner programming courses about a decade ago and did well with them. I am good with pseudocode, algorithms, and the mathematics of programming. I decided...
10
by: Stephany Young | last post by:
When one uses the System.Diagnostics.Process.Start method to launch a common or garden Console application, one can set the WindowStyle property of the StartInfo object to ProcessWindowStyle.Hidden...
43
by: Bill H | last post by:
25 years ago every computer came with some form of Basic interpreter so you could use yoru computer without having to buy more software. Is Javascript (teamed with HTML) set to become the new...
5
by: =?Utf-8?B?SmFtZXMgV29uZw==?= | last post by:
Dear all, I'd like to know if there is any method to minimize command mode window when a console program is running. In my case, there are several console programs which run periodically in...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.