console-application

ASP.Net 5 Console Application Entry Point

若如初见. 提交于 2019-12-13 01:03:22
问题 I've been trying to build a console application in ASP.Net 5 and am having some trouble with the entry point. I've looked at the following: Entry point can be marked with the 'async' modifier on CoreCLR? And https://msdn.microsoft.com/en-us/magazine/dn913182.aspx. When I create a Console Application (Package) with Visual Studio 2015 It creates the following Program File public class Program { public static void Main(string[] args) { } } However I want to utilise the instance have Main as an

Create a Window in a Visual Studio 2012 console application?

女生的网名这么多〃 提交于 2019-12-12 18:32:58
问题 Is there a way to create a Window in a C++ Console Application? I have already a console application for creating some data and I want to show them in some graphics, but not inside the console. Is this possible? 回答1: You use a function called CreateWindowEx(), See here. It's rather complex, you need to create a WNDCLASSEX structure and use RegisterClassEx() on it before passing it as a parameter to CreateWindowEx(). You also need to create Message Procedure function. This article on MSDN runs

Pauses between commands in simple console C# app

感情迁移 提交于 2019-12-12 18:19:20
问题 Is there any easy how to e.g. have 1 second delay between commands? I can only think of some large cycles. I know about thread.sleep but it is not what I am looking for - I would like to just use something else without relation to threads. Thanks for any idea 回答1: I think that you are after something like yield return. This allows you to have the pass control back to the calling code and then can carry on through your app. The link has a good example of its use. using System; using System

Open a Window since Programm class?

扶醉桌前 提交于 2019-12-12 17:54:52
问题 I have a console application. So I need Open a Window called "UserInterface.xaml" this is a Window. I my class Program I have this: class Program { [STAThread] static void Main(string[] args) { var userInterface = new UserInterface(); userInterface .Show(); } The problem is when the UserInterface.xaml is opened but then is closed immediately. And I need it for capture some data from user. this is my class UserInterface: public partial class UserInterface: Window { public UserInterface() {

Run npm init from the c# console app

谁都会走 提交于 2019-12-12 16:21:04
问题 I have try to run "npm init" command from the c# console app, using this code: private void Execute(string command, string arg) { Process p = new Process(); p.StartInfo.FileName = command; p.StartInfo.Arguments = arg; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardInput = true; p.StartInfo.WorkingDirectory = @"E:\Work\"; p.Start(); p.WaitForExit(); } Execute(@"C:\Program Files\nodejs\npm.cmd", "init"); But nothing happening. I

Type safety of input.nextLine?

瘦欲@ 提交于 2019-12-12 16:10:07
问题 Would there ever be a case where an exception could be thrown by assigning the value of input.nextLine() to a String variable with the Scanner ? Like if you put String foo = input.nextInt(); You would get an InputMismatchException . So what I'm wondering is if there's any possible way to get an exception from: String foo = input.nextLine(); It might be a dumb question but I need to be absolutely sure. Thanks in advance! 回答1: The answer in the docs: Throws: NoSuchElementException - if no line

Exit console without waiting press any key to continue…

瘦欲@ 提交于 2019-12-12 12:47:21
问题 I want to quit my Console Application, I have tried following commands: Enviroment.Exit(0); Application.Exit(); But it leads to Press any key to continue . . . . How could I exit my application without waiting any key? 回答1: This only appears when you're running it from within Visual Studio itself, but only when running it without attaching a debugger ( ctrl + F5 in most cases). Try actually running the built .exe in your Bin folder and observe the behavior of your application that way. 回答2:

Coinitialize has not been called error message

血红的双手。 提交于 2019-12-12 11:48:58
问题 I am in the process of coding a console application that will create a firewall exception for my main app called Client.exe which uploads a few documents to our servers via FTP. I borrowed RRUZ code from Delphi 7 Windows Vista/7 Firewall Exception Network Locations my code looks like this: program ChangeFW; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, ComObj; var ExecName: string; procedure AddExceptionToFirewall(Const Caption, Executable: String); const NET_FW_PROFILE2_DOMAIN = 1; NET

Set focus on console in Windows?

杀马特。学长 韩版系。学妹 提交于 2019-12-12 11:35:42
问题 Is it possible to set focus on a console app in Windows? SetFocus looks promising, but it needs an HWND and I don't know if console apps even have one. 回答1: Use the GetConsoleWindow function. 来源: https://stackoverflow.com/questions/3223688/set-focus-on-console-in-windows

Qt qDebug() doesn't work in Windows shell

青春壹個敷衍的年華 提交于 2019-12-12 11:05:27
问题 I am using a qDebug() of Qt Framework for printf something on the screen. It works just fine when I run application from Qt Creator, but when I try to execute it from Windows cmd it shows nothing. Why that happens? 回答1: You have to add CONFIG += console to your projects .pro file and do not forget to clean and build (rebuild) your project. 回答2: Run your application with application.exe > log.txt 2>&1 It redirects stderr to stdout and stdout to a file. 来源: https://stackoverflow.com/questions