H
Homer J. Simpson
Stupid question. I've been using C# 2.0 for the past few weeks, but mostly
in the context of ASP.NET. I have little to no experience with Win32 C#
apps.
My purpose is to write a windowless application to constantly monitor a COM
port (the one my modem is using), and write what it intercepts to a log
file. I've managed to do it (to a certain extent) in a console app--I
create a SerialPort object, initialize it, set its DataReceived member so I
have my event handler...and now, of course, if I only do that my program's
gonna exit right away, so I put Thread.Sleep() in an endless loop in Main().
Kinda silly, maybe, but that's the best I could come up with for the moment.
Now I wanna get rid of the console window. I want this to work as a
windowless program--I don't care if I don't have a UI to shut it down, nor
do I need to present any sort of configuration option. This is a
quick-and-dirty app for myself only.
Can somebody show me the 'proper' skeleton code for a minimal windowless C#
2.0 program and have it set up so I can then add my code to create a
SerialPort object, with an event handler, and wait indefinitely for those
events? I'm using Visual C# 2005 Express, and I have a few options that,
because of my lack of familiarity with writing Win32 apps with C#, leave me
a little puzzled:
a) an empty project, which I wouldn't know how to structure properly for my
purposes
b) a console application, which is what I'm trying to get away from (I want
to get rid of the console window)
c) a Windows form application, which I'd then have to modify somehow to get
rid of the default form.
in the context of ASP.NET. I have little to no experience with Win32 C#
apps.
My purpose is to write a windowless application to constantly monitor a COM
port (the one my modem is using), and write what it intercepts to a log
file. I've managed to do it (to a certain extent) in a console app--I
create a SerialPort object, initialize it, set its DataReceived member so I
have my event handler...and now, of course, if I only do that my program's
gonna exit right away, so I put Thread.Sleep() in an endless loop in Main().
Kinda silly, maybe, but that's the best I could come up with for the moment.
Now I wanna get rid of the console window. I want this to work as a
windowless program--I don't care if I don't have a UI to shut it down, nor
do I need to present any sort of configuration option. This is a
quick-and-dirty app for myself only.
Can somebody show me the 'proper' skeleton code for a minimal windowless C#
2.0 program and have it set up so I can then add my code to create a
SerialPort object, with an event handler, and wait indefinitely for those
events? I'm using Visual C# 2005 Express, and I have a few options that,
because of my lack of familiarity with writing Win32 apps with C#, leave me
a little puzzled:
a) an empty project, which I wouldn't know how to structure properly for my
purposes
b) a console application, which is what I'm trying to get away from (I want
to get rid of the console window)
c) a Windows form application, which I'd then have to modify somehow to get
rid of the default form.