console-application

HTTP Post in C# console app doesn't return the same thing as a browser request

I have a C# console app (.NET 2.0 framework) that does an HTTP post using the following code: StringBuilder postData = new StringBuilder(100); postData.Append("post.php?"); postData.Append("Key1="); postData.Append(val1); postData.Append("&Key2="); postData.Append(val2); byte[] dataArray = Encoding.UTF8.GetBytes(postData.ToString()); ...

some console GUI questions

For the following questions, answers may be for C/C++, C#, or Python. i would like the answers to be cross platform if possible but i realize i will probably need conio or ncurses how do i output colored text? how would i do a GUI like top or nethack where certain things are "drawn" to certain spaces in the terminal? if possible a ...

Horizontally scroll a text-based/console program

I am trying to use TestDisk (partition and file recovery program) to recover some files that I have lost. TestDisk runs as a text-based/console program and prints a long list of deleted files, one per line. Each file is listed as it's path and because I am running this from a rescue live linux cd, I am limited to a 80 character console. ...

SQl Server User Instance in Console Application

Is it possible to user SQL Server Express User Instance databases with Console applications or do they only work in Web projects? ...

Storing File Path as variable for C# Console Application

I'm trying to create a C# console application that will generate a log file. I'd like to have some flexibility with where the log file will be stored. I tried using the Settings.settings file with: Name: logDrive Type: string Scope: Application Value: C:\Scripts\Logs In my code, I'm using: string logFile = DateTime.Now.ToShortDateSt...

WebBrowser Control - Console Application - Events Not Firing

I have been navigating the various WebBrowser control stackoverflow questions, and I can't seem to find an answer to a problem I am having. I am trying to use the WebBrowser control to print a web page. Following MSDN's example, I have created the following console application: namespace WebPrintingMadness { using System; using ...

When should one use Environment.Exit to terminate a console application?

I'm maintaining a number of console applications at work and one thing I've been noticing in a number of them is that they call Environment.Exit(0). A sample program would look like this: public class Program { public static void Main(string[] args) { DoStuff(); Environment.Exit(0); } } I don't understand ...

C# Console Application - Keep it running

Hi, I am about to develop a console application that will be required to continually run and carry out work at specific times. My question is what is are best methods or practices to keep your application alive? My thought were: A loop that never ends? A timer that sleeps and then jumps to routine when required (after set sleep ...

What happens when you close a c++ console application

I guess the question says it all, but, what happens if someone closes a c++ console app? As in, clicks the "x" in the top corner. Does it instantly close? Does it throw some sort of exception? Is it undefined behavior? ...

Writing an executable function in C#

Hi, I'm really new to all of this. I need to write an exe application in C#. What i need to do is to be able to pass values through the console into a function. But I'm unsure as to how I can store the values that are entered through the console... I know we can use Read() to read what has been entered but, when I'm dealing with multipl...

How do I sleep in my MSVC++ console application?

The title says it all. I want to call Sleep(x), where x is milliseconds to sleep. I know this is the function, but it doesn't work for me. What do I need to include? ---SOLVED--- I was using the compiler option /Za, which disabled the native Windows extensions used in Sleep()'s implementation. ...

How can I use a timer in my console application?

How can I use a timer in my console application? I want my console application to work in the background and to do something every 10 minutes, for example. How can I do this? Thanks ...

C# Console App + Event Handling...

Hey all. I'm trying to see about handling events in a console application. I would prefer to not use silent WinForms (though I understand that that's one way) to do it. I've read over a similar question and its response. See response text below (link): The basic requirement of an STA thread is that it needs to run a message p...

How to determine if a previous instance of my application is running? [C#]

I have a console application in C# in which I run various arcane automation tasks. I am well aware that this should really be a Windows Service since it needs to run continuously, but I don't want to do that at this time. (So, don't suggest that as an answer). In the meantime, I need some sample C# code that will allow me to determine i...

Console application question

Hi I was wandering why when I create console application and 'transform' the main method to look identically with main method auto-generated when creating windows forms project, the console still appears on the screen: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using Sy...

Disable Javascript popups when using Windows.Forms.Webbrowser.Navigate()

Ok, I have a very frustrating problem. I am parsing a webpage and need to have it execute the javascript in order to get the information I want. Form f = new Form(); WebBrowser w = new WebBrowser(); w.Navigate(url); f.Controls.Add(w); f.ShowDialog(); HtmlElementCollection hc = w.Document.GetElementsByTagName("button"); This works and...

Include my code to windows forms application

The main problem is as follows: I did my code in console application and I don't know how can I include my code to WinForms application. I am using Visual studio 2008. I need to know where I should paste my code. Thanks. ...

start windows console app parameters

what parameters should i use to start a console app minimized or hidden? is this possible without using a 3rd party program? with a batch file ...

How do I structure a C# console application to efficiently use IDisposable database resources?

Here's my proposed (very simplified to illustrate the problem space) design for a C# console application. The database connections implement IDisposable, and this solution doesn't allow for using the database connection objects. Can someone propose a more correct structure for a console application? This is a problem I need to solve ...

Accessing SQL Server from Console application

I have a simple Console Application which connects to SQL Server database. However it throws the following error while running. Any clues? Unhandled Exception: System.Data.SqlClient.SqlException: Cannot open database "Database" requested by the login. The login failed. Login failed for user 'MYDOMAIN\MYUSERID'. at System.Data.SqlClie...