Write a program for modifying a file

T

TonyJ

Hello!!

I'm supposed to write a program that modify a file with data that has been
entered in the installation program(inno setup).

This program will start after the install file has been created.

When the program start that modify the file(s) I don't want the console
window to appear.
I just want the program to do what I have specified without having any kind
of output.

So my question is can I switch off the console window when the program run
or
is it any other possibilities.

When I develop the program I will use the console application but when I
deploy the program I want to remove
the console window.
So when the program is run you should not see anything as output to the
user.

//Tony
 
K

Kerem Gümrükcü

Hi Tony,

develop the application as a windows programm with
a invisible window and control its beahviour with a e.g.
command line option. Run the application hidden for no
user output and if you want a console, create a console
with the windows api AllocConsole(), use the standard
console output functions for the allocated console to
write and read from it and when you are done, just
do a Win api FreeConsole() to free the console. The
visibility of the console can be triggered with a command
line option, something like "yourapp.exe -c" or whatever
you want,...

Some Code:

[DllImport("kernel32.dll", SetLastError=true, ExactSpelling=true)]
static extern bool AllocConsole();

[DllImport("kernel32.dll", SetLastError=true, ExactSpelling=true)]
static extern bool FreeConsole();


AllocConsole();
Console.WriteLine("Some Console Output");
/*...Some code for reading or wirting from/to console
and when done do a FreeConsole()*/
FreeConsole();

Thats it!


Regards

Kerem


--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
(e-mail address removed)

Best Quote: "Ain't nobody a badass with a double dose
of rock salt...", Kill Bill Vol.2

Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
Sign my guestbook: http://entwicklung.junetz.de/guestbook/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top