console-application

.net console app with hyperlinks?

拈花ヽ惹草 提交于 2019-12-10 20:52:10
问题 is it possible ? any samples/patterns or ideas on how to go about it ? Update - this essentially becomes a text browser which displays various tables of information based on various commands on the prompt like typing the url in a browser now instead of typing various commands like prompt>command arg1 arg2 if only you could say "click" on the text in a certain "column"/"row" which would execute the command say prompt>commandX arg1 it'd be somewhat faster/easier Now, before someone mentions

load a web page and click a button using c#

最后都变了- 提交于 2019-12-10 18:46:25
问题 I have a requirement to automate a procedure on a web page. Open a web page Find an input Click on it Close the web page I would like to achieve all of the above using c# in a console application . I dont want to open any browser, but just a code to automate this process. I have a URL to a web page and also ID of an input element. What c# code should I use to achieve this.? 回答1: I think this probably would be able to serve the purpose. Selenium 1 (Selenium RC) : The Selenium Server which

How to close an “orphaned” console window that was opened from within visual studio?

拜拜、爱过 提交于 2019-12-10 18:39:47
问题 When working on console applications in Visual Studio, I will run the application by pressing F5 to bring it into debug mode. Occasionally (and I'm not sure how this happens), I'll get back into "edit mode" in Visual Studio and the debugged console window will still be open. It will remain open but entirely unresponsive. I can't close the window by right-clicking the window and clicking "close"; I can't close it via the Task Manager, and I can't close it by ending a particular process (to my

Console Application Structure

十年热恋 提交于 2019-12-10 16:39:26
问题 I've written several .Net Console Applications over the past 6 months and we have many more throughout different projects in our organization. I generally stick to the same standard format/structure for my Console Applications. Unfortunately, many of our console applications do not. I have been looking into ways of standardizing the structure of these Console Applications. I would also like to provide a framework for the basic structure of a Console Application and provide easy access to

Changing thread context in C# console application

亡梦爱人 提交于 2019-12-10 15:46:29
问题 I have a C# console app in which I can get, among other things, input via a TCP socket connection. How do I switch to the main thread when I receive an input via the receive function over the socket? So similar to something like this in WPF: public void TaskDispatcher() { if (DispatcherObjectForTaskDispatcher.Thread != System.Threading.Thread.CurrentThread) DispatcherObjectForTaskDispatcher.Invoke(new TaskDispatcherDelegate(TaskDispatcher)); else { // Do some thing in the UI thread } } 回答1:

Key value pair as a param in a console app

自闭症网瘾萝莉.ら 提交于 2019-12-10 13:18:17
问题 Is there an easy way to allow a collection of Key/Value pairs (both strings) as command line parameters to a console app? 回答1: If you mean having a commandline looking like this: c:> YourProgram.exe /switch1:value1 /switch2:value2 ... This can easily be parsed on startup with something looking like this: private static void Main(string[] args) { Regex cmdRegEx = new Regex(@"/(?<name>.+?):(?<val>.+)"); Dictionary<string, string> cmdArgs = new Dictionary<string, string>(); foreach (string s in

How to call event before Environment.Exit()?

馋奶兔 提交于 2019-12-10 12:48:20
问题 I have a console application in C#. If something goes wrong, I call Environment.Exit() to close my application. I need to disconnect from the server and close some files before the application ends. In Java, I can implement a shutdown hook and register it via Runtime.getRuntime().addShutdownHook() . How can I achieve the same in C#? 回答1: You can attach an event handler to the current application domain's ProcessExit event: using System; class Program { static void Main(string[] args) {

How to determine if I'm running as a console app? (Delphi on Win32)

若如初见. 提交于 2019-12-10 12:47:07
问题 I have a common unit that does some logging to GExperts Debugger and/or OutputDebugString. I am going to use it in a console app, so I want it to be able to output to stdout via writeln() . The main executable has {$APPTYPE CONSOLE} already, but I don't think that'll help me here. The logging routine will be called from several places: the main console app, which will link to a BPL, from another BPL that "requires" the first bpl, and..... from a DLL that statically links the unit. The BPLs

.NET Core Global exception handler in console application

孤街醉人 提交于 2019-12-10 12:33:26
问题 I'm porting an console application to .NET Core , and I'm trying to replace this line: AppDomain.CurrentDomain.UnhandledException += UnhandledException; After reading this, it seems there is no built-in way to do this. So my question: is the only way to replace this line surrounding my entire code with a try/catch ? By reading this, it seems like there is another way, namely by keep on using System.AppDomain , but I can't seem to find this class/method. My only guess was this library, but it

% versus FMOD for calculating modulus [closed]

吃可爱长大的小学妹 提交于 2019-12-10 12:24:38
问题 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 8 months ago . My console app looks like that. #include "stdafx.h" #include <iostream> #include <cmath> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int a, b; cin>>a>>b; cout<<"% "<<a%b<<endl<<"fmod "<<fmod(a,b)<<endl; system("pause"); return 0; } I'm newbie to C++ and I got 2