console-application

What is the Purpose of Console.WriteLine() in Winforms

孤街浪徒 提交于 2019-12-04 18:14:43
问题 I once saw the source code of a winform application and the code had a Console.WriteLine(); . I asked the reason for that and i was told that it was for debugging purposes. Pls what is the essence of Console.WriteLine(); in a winform and what action does it perform because when i tried using it, it never wrote anything. 回答1: It writes to the Console. The end user won't see it, and to be honest its much cleaner to put it into a proper log, but if you run it through VS the Console window will

C++ Prevent the console window from closing when red X is clicked

烂漫一生 提交于 2019-12-04 18:03:58
I'm developing a simple C++ console application without classes & objects. Is there any method or function to prevent the console from closing when red X button is clicked ? I'm using Visual Studio C++ Express 2010 : A simple console application which containes only main.cpp file. Thank you for answering my question :) !! This worked for me: #include "conio.h" void main() { HWND hwnd = GetConsoleWindow(); HMENU hmenu = GetSystemMenu(hwnd, FALSE); EnableMenuItem(hmenu, SC_CLOSE, MF_GRAYED); } While we're at it, to re-enable the button: EnableMenuItem(hmenu, SC_CLOSE, MF_ENABLED); ... and to set

The definitive code that prevents a c# console app from exiting [until custom cleanup code has completed]

為{幸葍}努か 提交于 2019-12-04 17:48:46
Can we work together to come up with something that works for control-c, control-break, log off, window X button pressed, etc? Here is what I have so far: class Program { private static ConsoleEventHandlerDelegate consoleHandler; delegate bool ConsoleEventHandlerDelegate(CtrlTypes eventCode); static void Main(string[] args) { consoleHandler = new ConsoleEventHandlerDelegate(ConsoleCtrlCheck); SetConsoleCtrlHandler(consoleHandler, true); System.Diagnostics.Process.GetCurrentProcess().Exited += delegate(object sender, EventArgs e) { GeneralManager.Stop(); }; Console.CancelKeyPress += delegate

Making UI for console application [closed]

◇◆丶佛笑我妖孽 提交于 2019-12-04 17:35:26
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . How can I make an interface for console applications to make them look like edit.com under Microsoft's operating systems. Target languages are C, C++ and C#.NET. 回答1: Have a look at curses: e.g.: http://sourceforge.net/projects/curses-sharp/ 回答2: That would be based on a very

How do I get a console application to check for updates without using ClickOnce?

我是研究僧i 提交于 2019-12-04 17:31:16
In a normal Windows application I can use... System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CheckForUpdate() ...to determine whether or not there is an update available. I know I can use System.Reflection and Assembly and AssemblyName to print the version of the application as it is currently running, but I don't know how to get it to compare that to what's been published most recently. What is the equivalent to CheckForUpdate() for a console application, without using ClickOnce? You would need something server side that the application can use to find out what the most

Publishing C# console application

坚强是说给别人听的谎言 提交于 2019-12-04 17:16:33
问题 I have developed a C# console application using VS2010. Now i would like to make it into a setup.exe. Is it possible to have this setup.exe as a standalone file to run my program? Meaning how can i achieve in obtaining setup.exe that when i click on that file it will run my console without even opening VS and without the need of my project folder on the workstation. I have tried numerous time doing myself but failed up till now. Some advice please. Thanks, 10e5x 回答1: You can publish it. Go to

Error : the application was unable to start correctly [duplicate]

本秂侑毒 提交于 2019-12-04 17:03:49
This question already has an answer here: The application was unable to start correctly (0xc000007b) 17 answers Can anyone tell me what causes this error: I don't know what other information about the project may be needed to be included! If you need more information, it would be appreciated to inform me. But please help me! I'm running the program on a Win7x64 ultimate and this is the configuration of my project: also these are the paths of include and library directories that are needed in the project: the program uses OpenGL , GLU , GLUT and GDAL/OGR libraries, which I have downloaded GDAL

How can I obtain the named arguments from a console application in the form of a Dictionary<string,string>?

亡梦爱人 提交于 2019-12-04 16:46:51
问题 I have a console application called MyTool.exe What is the simplest way to collect the named arguments passed to this console applicaiton and then to put them in a Dictionarty<string, string>() which will have the argument name as the key and the value as the argument? for example: MyTool foo=123432 bar=Alora barFoo=45.9 I should be able to obtain a dictionary which will be: MyArguments["foo"]=123432 MyArguments["bar"]="Alora" MyArguments["barFoo"]="45.9" 回答1: Use this Nuget package V1.9.x -

Why is console animation so slow on Windows? (And is there a way to improve speed?)

一曲冷凌霜 提交于 2019-12-04 16:16:29
Well I was bored so wanted to make an animation in a console window. Now when I setup the first bits I noticed it is very slow, something around 333ms for a whole screen to fill with characters.. I am wondering if there is a way to at least get ~20 fps? Here is my code: #include <stdio.h> #include <tchar.h> #include <Windows.h> #include <iostream> #include <array> #define WIDTH (100) #define HEIGHT (35) bool SetWindow(int Width, int Height) { _COORD coord; coord.X = Width; coord.Y = Height; _SMALL_RECT Rect; Rect.Left = 0; Rect.Top = 0; Rect.Bottom = Height - 1; Rect.Right = Width - 1; HANDLE

SetConsoleActiveScreenBuffer does not display screen buffer

余生长醉 提交于 2019-12-04 16:16:06
I am currently trying to write a console application in C# with two screen buffers, which should be swapped back and forth (much like VSync on a modern GPU). Since the System.Console class does not provide a way to switch buffers, I had to P/Invoke several methods from kernel32.dll. This is my current code, grossly simplified: static void Main(string[] args) { IntPtr oldBuffer = GetStdHandle(-11); //Gets the handle for the default console buffer IntPtr newBuffer = CreateConsoleScreenBuffer(0, 0x00000001, IntPtr.Zero, 1, 0); //Creates a new console buffer /* Write data to newBuffer */