console-application

Maximizing console window - C#

妖精的绣舞 提交于 2019-12-03 10:12:10
I'm working on a console application on C# and I need to open the console maximized. When I just hit the maximize button on the console window, it maximizes only on height and not in width. I tried to use the following code : Console.WindowWidth = 150; Console.WindowHeight = 61; Which works almost as I want on my computer but gives error on some other computers. What should I do to maximize the console? Can't with the CLR. Need to import Win32 API calls and poke your container window. The following might help. using System.Diagnostics; using System.Runtime.InteropServices; [DllImport("user32

Get IP address in a console application

邮差的信 提交于 2019-12-03 10:08:32
I am looking to figure out what my IP address is from a console application. I am used to a web application by using the Request.ServerVariables collection and/or Request.UserHostAddress . How can this be done in a console app? The easiest way to do this is as follows: using System; using System.Net; namespace ConsoleTest { class Program { static void Main() { String strHostName = string.Empty; // Getting Ip address of local machine... // First get the host name of local machine. strHostName = Dns.GetHostName(); Console.WriteLine("Local Machine's Host Name: " + strHostName); // Then using host

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

断了今生、忘了曾经 提交于 2019-12-03 09:54:43
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" Mrchief Use this Nuget package V1.9.x - Command Line Parser Library (CodePlex - Going away soon and out of date) V2+ - Command Line Parser

Code stops executing when a user clicks on the console window

半城伤御伤魂 提交于 2019-12-03 09:24:57
问题 I've got a console application that executes my code without user interaction. If the user clicks within the console window, on purpose or on accident, all execution stops. This has something to do with copying text from the console window. The only way for the application to start executing again is if the user selects text and then right-clicks on the console window, copying it to the clipboard. To see this in action, create a console application and add the following code. class Program {

Multiple objects drawing (OpenGL)

情到浓时终转凉″ 提交于 2019-12-03 09:03:12
问题 The issue is that I can't figure out how to properly draw two objects, because my another object isn't being drawn. Here's the main code: GLuint VertexArrayID; glGenVertexArrays(1, &VertexArrayID); glBindVertexArray(VertexArrayID); GLuint VertexArrayID2; glGenVertexArrays(1, &VertexArrayID2); glBindVertexArray(VertexArrayID2); GLuint programID = LoadShaders( "SimpleVertexShader.vertexshader", "SimpleFragmentShader.fragmentshader" ); GLuint MatrixID = glGetUniformLocation(programID, "MVP");

Calling console application from asp.net

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 08:26:39
I try to call console appliction from asp.net when i put breakpoint in console app why it can't stop there.How can i call console application? var proc = Process.Start("D:\\Edefter\\EFaturaConsoleTxtParser\\bin\\Debug\\EFaturaConsoleTxtParser.exe", "/arg1 /arg2"); proc.WaitForExit(); I'm not sure about this but anyway you can try ProcessStartInfo startinfo = new ProcessStartInfo(); startinfo.FileName =@"D:\\Edefter\\EFaturaConsoleTxtParser\\bin\\Debug\\EFaturaConsoleTxtParser.exe"; startinfo.CreateNoWindow = true; startinfo.UseShellExecute = true; Process myProcess = Process.Start(startinfo);

HttpUtility.UrlEncode in console application

↘锁芯ラ 提交于 2019-12-03 08:17:07
问题 I'd like to use HttpUtility.UrlEncode in a console application, VB.NET, VS 2010 Beta 2. System.Web.HttpUtility.UrlEncode(item) Error message: 'HttpUtility' is not a member of 'Web'. In this question Anjisan suggests to add a reference to System.Web, as follows: In your solution explorer, right click on references Choose "add reference" In the "Add Reference" dialog box, use the .NET tab Scroll down to System.Web, select that, and hit ok However, I don't have a System.Web entry at that

How do I redirect a console program's output to a text box in a thread safe way?

与世无争的帅哥 提交于 2019-12-03 07:52:38
问题 I am having trouble redirecting console output to a windows forms text box. The problem is thread related. I am running a console app in the following way, private void RunConsoleApp() { Process proc = new Process(); proc.StartInfo.FileName = "app.exe"; proc.StartInfo.Arguments = "-a -b -c"; proc.StartInfo.UseShellExecute = false; // set up output redirection proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.RedirectStandardError = true; proc.EnableRaisingEvents = true; proc

what is the difference between win32 application, windows form application and console application?

强颜欢笑 提交于 2019-12-03 07:17:59
I want to know what is the difference between windows form application, win32application ana console, i know that both the windows form application and win32 application is gui tool, but i want to know when to use one over the other one, and could I convert console application to windows form application ? Windows Form refers to a .NET application. It's not based directly on the native Windows API, but instead on the .NET infrastructure. Which includes a virtual machine. Win32 generally refers to the 32-bit Windows API. However, the _WIN32 macro is defined for both 32-bit and 64-bit

Windows 7 taskbar state with minimal code

拜拜、爱过 提交于 2019-12-03 06:59:44
问题 What would be the shortest code to set the state of a Windows 7 taskbar button for a known window handle? The goal is to write a console utility that changes the progress and state (colour) of the console window taskbar item from a batch script. While the script performs different tasks, the taskbar item of its console window should represent the current state. I get the window handle with the GetConsoleWindow() function, but then it seems to require loads of COM and Shell API stuff that I