console-application

Displaying Arabic characters in C# console application

久未见 提交于 2019-11-26 17:55:54
I believe it was possible to show Arabic characters on a console application 13+ years ago, since the days of Windows ME. Now i am using Visual Studio 2013, On a Windows 8, and the following code shows: ????? ?? Console.OutputEncoding = System.Text.Encoding.Unicode; Console.WriteLine("مرحبا بك"); Is there anyway to show Arabic characters in the console output? J... There are several issues to resolve to get this to work. You need a font that supports both Arabic AND the windows console. See KB : Necessary criteria for fonts to be available in a command window The font must be a fixed-pitch

Console application with Java and gradle

被刻印的时光 ゝ 提交于 2019-11-26 17:45:10
问题 I am writing a console application with Java and gradle. I am using the application plugin and have the required fields correctly configured in build.gradle . In my main class I have BufferedReader linked with System.in . Here's the problem: When I run gradle run in project directory, the reader does not wait for my console input. BufferedReader#readLine instead returns null on the very first call. This behavior is not desirable for what am I doing. What is the solution? Is there a separate

C# Console App + Event Handling

孤者浪人 提交于 2019-11-26 17:09:36
问题 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 pump. In Windows Forms, you can use Application.Run. Or you could write the message pump by hand, using user32!GetMessage & DispatchMessage. But it's probably easier to

Using ELMAH in a console application

送分小仙女□ 提交于 2019-11-26 17:03:48
I just started using ELMAH and am a fan. My team supports a large number of web applications and I'm particularly excited that ELMAH lets us save exceptions from each application to the same MS SQL database table. We also support a few console, DLL and desktop applications. Is it possible to use the ELMAH DLL to log exceptions in these apps to that same location? We have exactly the same situation here. Running ELMAH for all our web applications. A few of them have console based schedulers. After doing some digging through the source code, the following code seems to work: ErrorLog errorLog =

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

橙三吉。 提交于 2019-11-26 16:31:27
问题 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 what the intent of the original programmer was in doing this? In my mind even without the Environment.Exit statement the program should exit just fine. That said, for one of these programs,

Console App Mouse-Click X Y Coordinate Detection/Comparison

爷,独闯天下 提交于 2019-11-26 16:28:21
问题 I have a game that I am working on in a C# console application, purely as practice before going on to better methods. As opposed to using something such as a Windows Forms App, which has button functionality built in, I am endeavoring to grab the cursor position (which I know how to do) and compare it to a number of area's inside a console application as defined by perhaps pixel location, but I also do not know if there is some sort of built in unit of space other than pixels (this last bit

How can a C# Windows Console application tell if it is run interactively

▼魔方 西西 提交于 2019-11-26 16:13:53
问题 How can a Windows console application written in C# determine whether it is invoked in a non-interactive environment (e.g. from a service or as a scheduled task) or from an environment capable of user-interaction (e.g. Command Prompt or PowerShell)? 回答1: Environment.UserInteractive Property 回答2: To determine if a .NET application is running in GUI mode: bool is_console_app = Console.OpenStandardInput(1) != Stream.Null; 回答3: I haven't tested it, but Environment.UserInteractive looks promising.

How to run a .NET console application in the background

大城市里の小女人 提交于 2019-11-26 16:07:44
I have a console application written in C# that is scheduled to run every 15 minutes or so using the built-in Windows Task Scheduler. Every time it runs, the black console box pops up for the duration of its execution and then closes. I am not writing anything to the console. Is there a way to make this run in the background? Daniel Dolz Easy! It seems hard to believe, but it works as a charm. I have used this for some setup projects, when you want to perform custom tasks with no signs of it. Create the project as a Windows application project (this is the hard part). Never make calls to any

Compile to a stand-alone executable (.exe) in Visual Studio

本小妞迷上赌 提交于 2019-11-26 15:58:10
问题 how can I make a stand-alone exe in Visual Studio. Its just a simple Console application that I think users would not like to install a tiny Console application. I compiled a simple cpp file using the visual studio command prompt. Will the exe work even if the .NET framework is not installed? I used native C++ code. 回答1: Anything using the managed environment (which includes anything written in C# and VB.NET) requires the .NET framework. You can simply redistribute your .EXE in that scenario,

Run console application from other console app

百般思念 提交于 2019-11-26 15:52:42
问题 I have a C# console application (A). I want to execute other console app (B) from within app A (in synchronous manner) in such way that B uses the same command window. When B exists, A should be able to read B's exit code. How to do that? I need only this little tip on how to run this other app in same cmd window. 回答1: You can use Process.Start to start the other console application. You will need to construct the process with ProcessStartInfo.RedirectOutput set to true and UseShellExecute