console-application

C++: How do I check if my window is about to close?

僤鯓⒐⒋嵵緔 提交于 2019-12-08 03:06:09
问题 I'm trying to make a Win32/*nix console-based ASCII game. I want to use no libraries whatsoever that aren't standard C++ or on *nix/windows(.h). I want it to be structured like a game loop. Aka: while (!WIN_CLOSE_FUNCTION()) { //Do crap } //Do other shutdown crap return 0; Can anyone point me to what function this would be? If it is platform dependent, give me one example on Windows and *nix. 回答1: Similar question that might help you What happens when you close a c++ console application The

Changing the console size

浪尽此生 提交于 2019-12-08 03:02:07
问题 Simple problem in Delphi. I've created a console application and I need to change the height of the console window to 80 lines, if it's less than 80 lines. This need to be done from code and is actually conditional within the code. (I.e. when an error occurs, it increases the size of the console so the whole (huge) error report is visible.) Keep in mind that this is a console application! When it starts, it uses the default console, which I need to alter! 回答1: When calling

How to deal with output from console applications that use control characters?

南楼画角 提交于 2019-12-08 01:01:54
问题 I want to call an executable (in my case, this is PNGOUT.exe) and grab its output from stdout. But it turned out to be tricky - the application uses some sort of control characters to replace previously printed output (display of progress), and C# classes happily record them and when I want to analyze the output string, I get serious headache. (It even took a while for me to figure out what's happening with my string) I'm calling executable with following method: public static string

C# - Console Keystrokes

佐手、 提交于 2019-12-08 00:57:14
问题 I want to compare the key pressed in a console to the left arrow key if they are equal meaning the key pressed was the left arrow key, key change the background color of the console to cyan... I'm not sure how to set up the If statement though, because I dont know how to compare keys in a console. using System; namespace ConsolePaint { class MainClass { public static void Main (string[] args) { ConsoleKeyInfo keypress; keypress = Console.ReadKey(); // read keystrokes if ( keypress.KeyChar ==

ADAL user consent triggered even when admin has already consented

南笙酒味 提交于 2019-12-08 00:39:24
问题 I've created a Web API which uses Azure Active Directory for its authentication. It uses a multi-tenant AAD. To test it, I also created a console app which uses the ADAL library to authenticate against AAD so I can access my API. In the main AAD tenant all is working well, because I don't need to grant anything. But when accessing the app from a second tenant, I first trigger the admin consent flow (adding a prompt=admin_consent ). But when I exit and open the app again, if I try to login

sql job to run every certain time and execute a console application

扶醉桌前 提交于 2019-12-08 00:23:24
I am trying to write a SQL job to run every 10 minutes and to execute a console application that I wrote in C#. It would be really helpful if someone could help. What you want is a SQL Server Agent Job, with a CmdExec step (which can execute a windows command line). This is explained here: http://msdn.microsoft.com/en-us/library/ms190264.aspx If security is a concern, it can be secured through the use of a SQL Agent Proxy definition. This is explained here: http://msdn.microsoft.com/en-us/library/ms189064(SQL.105).aspx 来源: https://stackoverflow.com/questions/14266561/sql-job-to-run-every

convert xls to xlsm using excelcnv.exe

旧街凉风 提交于 2019-12-07 17:33:57
问题 i had create one console application. and use the microsoft ppcnvcom.exe, excelcnv.exe, wordconv.exe to convert the doc to docx, xls to xlsx and ppt to pptx. but can anyone know this how to convert xls to xlsm? OFC.exe is the one choice but when i called it from sharepoint it not converted successfully.some security issu is block the converter. OFC.exe automatically identify if xls have a macro in it then it convert to xlsm file. but i want this using excelcnv.exe ? have any idea? 回答1:

How to pass HostControl instance to custom host service in TopShelf?

社会主义新天地 提交于 2019-12-07 17:14:03
问题 This question has been asked elsewhere on SO, but there is no indication of how I get an instance of a HostControl as the post suggests. My TopShelf main program looks like this: public static void Main() { HostFactory.Run(CreateHost); } private static void CreateHost(HostConfigurator x) { x.UseLog4Net(); x.Service<EventBroker>(s => { s.ConstructUsing(name => new EventBroker()); s.WhenStarted(tc => tc.Start()); s.WhenStopped(tc => tc.Stop()); }); x.StartAutomatically(); x.RunAsNetworkService(

Both CLI and GUI application

谁说我不能喝 提交于 2019-12-07 15:53:34
问题 I am writing an application that has both CLI and GUI. I read most questions and articles regarding it, and found highly usefull this question: Can one executable be both a console and GUI application? My final code looks like: if (args.Length > 0) { //console code } else { FreeConsole(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form()); } This works great when running the .exe by double click, or when debugging, or from

Using Console.WriteLine in a Timer why it would appear to exit?

一世执手 提交于 2019-12-07 14:41:11
问题 I have a console application,when I use Console.ReadLine() ,the application will show "Hello World".why Console.ReadKey() can't?` static void Main(string[] args) { System.Timers.Timer timer = new System.Timers.Timer(1000); timer.Elapsed += timer_Elapsed; timer.Enabled = true; Console.ReadKey();// When use ReadLine() work fine; } static void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { Console.WriteLine("Hello World"); } Fixed:http://support.microsoft.com/kb/2805221 回答1: