console-application

SetConsoleMode fails with zero, lasterror = 0

回眸只為那壹抹淺笑 提交于 2019-12-05 11:26:30
This is not a duplicate! - Well, after reading the comments, maybe it is. I was looking for a way to italicize text in the console output of a console application, in c#, Visual Studio 2015, Targeting .NET Framework 4.5.2, OS = Windows 7. The Microsoft Documentation is pretty clear It's here - and it's so misleading it's wrong. This is an OS problem. I found the following question with a solution that does what I want by Vladimir Reshetnikov, adding text decorations to console output answered Mar 28 at 19:52 in one of the answers, and code like it in git, and elsewhere... my problem is -

SetConsoleCtrlHandler routine issue

戏子无情 提交于 2019-12-05 10:12:48
问题 I'm writting a console application in C++. I use SetConsoleCtrlHandler to trap close and CTRL+C button. This allows for all my threads to stop and exit properly. One of the thread performs some saving that require some time to complete and I have some code to wait in the console crtl handle routine. MSDN specify that a box should pop up after 5 seconds for CTRL_CLOSE_EVENT, but instead my process exits. This is annoying for debugging console application too as the process exits before you can

How to handle java passwd reading when System.console() returns null?

不想你离开。 提交于 2019-12-05 10:09:02
I'm writing a commandline program that prompts for a passwd and I don't want it to do local echo of the password characters. After some searches, I have stumbled upon System.console().readPassword() , which seems great, except when dealing with pipes in Unix. So, my example program (below) works fine when I invoke it as: % java PasswdPrompt but fails with Console == null when I invoke it as % java PasswdPrompt | less or % java PasswdPrompt < inputfile IMHO, this seems like a JVM issue, but I can't be the only one who has run into this problem so I have to imagine there are some easy solutions.

Why Does VS2010 “Lose” my reference on build?

家住魔仙堡 提交于 2019-12-05 10:06:58
问题 I've developed a class library that does stuff, and tested it with unit tests. The library and tests build and work fine. I then added in a Windows Service project to the solution to wrap the library up in. I've added a reference to my class project, added a using statement and var'd an object from the class lib. It colour-codes just fine and Refactor can ctrl-click and navigate into it, but when I build the project/solution, it claims the type of my is unknown and there's an exception: The

Using Readline() and ReadKey() Simultaneously

吃可爱长大的小学妹 提交于 2019-12-05 09:53:09
Is there any way to detect both Readline and ReadKey, so that in most cases it behaves as a readline, except for some special key inputs that should be detected? I need some "parallel" implementation to introduce simultaneity. The code below is synchronous and does not meet my need while ((line = Console.ReadLine()) != "x") { if (line == "BLABLA") { //Stuff } else { //Stuff } ConsoleKeyInfo ki = Console.ReadKey(true); if ((ki.Key == ConsoleKey.V) && (ki.Modifiers == ConsoleModifiers.Control)) { //Stuff } } Here's a function I just made to do this. Right now it only handles backspace, enter,

Create a standalone .exe file

非 Y 不嫁゛ 提交于 2019-12-05 09:52:11
I have a console application built in visual studio 2010. When I actually build the project I am getting .exe file under \bin\Debug\MyProj.exe. When I Paste and run this .exe from other location it is expecting other files too. Any thoughts how can I make this as Stand alone exe file. There should be other DLL's in the Debug library. You need those to run your exe. If there are no DLL's there, make sure you set the 'Copy local' property of the required references to True, and build again. If you want to make a standalone program, you should create a new Setup project in your solution. Include

Python Interactive Shell Type Application

风流意气都作罢 提交于 2019-12-05 08:38:28
I want to create an interactive shell type application. For example: > ./app.py Enter a command to do something. eg `create name price`. For to get help, enter "help" (without quotes) > create item1 10 Created "item1", cost $10 > del item1 Deleted item1 > exit ... I could of course use a infinte loop getting user input, splitting the line to get the individual parts of the command, but is there a better way? Even in PHP (Symfony 2 Console) they allow you to create console commands to help setup web applications for example. Is there something like that in Python (I am using Python 3) Just

How do I set the position of the mouse cursor from a Console app in C#?

流过昼夜 提交于 2019-12-05 07:57:06
I've found many articles on how to set the mouse position in a C# windows forms project - I want to do this in a console application. How can I set the absolute mouse position from a C# windows console application? Thanks! Hint: it's not Console.setCursorPosition, that only sets the position of the text cursor in the console. Inside your console application, add a reference to System.Windows.Forms.dll and use the other techniques you've read about. The choice of console vs windows exe only impacts the PE header (and maybe the default code template, but you can hack that trivially); you can

How to disable Open file – Security warning

时光毁灭记忆、已成空白 提交于 2019-12-05 07:52:44
I have a weird question. I have written a winform server application and a winform client application. The role of the client is to send commands for running a certain script to the server. The server receives those commands, parses them, and runs them. These two work great. I have written a cmd application which uses some of the functions from my client. This application is supposed to function as a cmd client. The question is this: When I run the winform client, the server runs the commands with no problems at all. When I run the cmd client, when the server attempts to execute the received

Interactive console programming for c/c++?

家住魔仙堡 提交于 2019-12-05 05:43:13
So I've written a small program which takes in commands by the users, and then displays the output (after connecting to a server). It's an interactive console of sorts. However, after using the mongodb and redis command-line clients (which work interactively on the console/terminal), it seems that there must be a library somewhere which provides functionalities such as recording user inputs, accepting up/down keypresses to browse through command history, as well as tab completion framework (not sure how that one would work, but yeah). What's an ideal library to use for such a thing? The