console-application

How to add font color to a .net console app?

痴心易碎 提交于 2019-12-03 23:26:40
Is there a way to color the font of certain lines in a console app in .net? Thanks http://msdn.microsoft.com/en-us/library/system.console.foregroundcolor.aspx You can change the foreground and background colors of the console. The foreground color is of course the text. Console.BackgroundColor = ConsoleColor.Blue; Console.ForegroundColor = ConsoleColor.Yellow; 来源: https://stackoverflow.com/questions/5299790/how-to-add-font-color-to-a-net-console-app

SetConsoleCtrlHandler routine issue

不羁的心 提交于 2019-12-03 22:35:31
I'm writting a console application in C++. I use SetConsoleCtrlHandler to trap close and CTRL+C button. This allows for all my threads to stop and exit properly. One of the thread performs some saving that require some time to complete and I have some code to wait in the console crtl handle routine. MSDN specify that a box should pop up after 5 seconds for CTRL_CLOSE_EVENT, but instead my process exits. This is annoying for debugging console application too as the process exits before you can step through and I don't know what may be the problem (I have Windows 7 64bits). Also, strangely if my

Bankteller console application

吃可爱长大的小学妹 提交于 2019-12-03 21:56:14
I'm making a simple application to simulate the bankteller problem . What I'm trying to simulate is: You have 4 counters in a store. 1 counter is open. Customers start coming in and enter the line for the first counter. When the fourth customer enters the line for the first counter, another counter should open. The line should be equally divided between the 2 counters.When the customer at the second counter is helped and no new customers enter the line, the counter should close. Basically 4 is too many. I can't seem to figure it out. I know I need to use a queue. But how? Could someone give me

How to go up a line in Console Programs (C++)

ⅰ亾dé卋堺 提交于 2019-12-03 21:09:57
问题 In C++ I'm trying to go back up a line to add some characters. Here is my code so far: cout << "\n\n\n\n\n\n\n\n\n\n\xc9\xbb\n\xc8\xbc"<<flush; Sleep(50); As you can see, I have 10 newline characters. In my animation, a new block will be falling from the top of the screen. But I don't know how to go back up those lines to add the characters I need. I tried \r, but that dosen't do anything and \b dosen't go up the previous line either. Also, what exactly does flush do? I've only been

Is there a better way to remove all of the three buttons on the title-bar and remove the scroll-bar using Windows API?

浪子不回头ぞ 提交于 2019-12-03 20:28:30
The code removing all of the three buttons on the title-bar and removing the scroll-bar I use in "Windows 7" so far is listed: #define WINVER 0x0501 // WinXP and UP #include <windows.h> int main ( void ) { //Get a console handle HWND ConsoleWindow = GetConsoleWindow(); //Change Settings SetWindowLong (ConsoleWindow, GWL_STYLE, WS_THICKFRAME); SetWindowLong (ConsoleWindow, GWL_STYLE, WS_CAPTION); SetWindowPos (ConsoleWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_SHOWWINDOW); //Resize system ("mode con cols=75 lines=50"); system ("pause>nul"); return 0; } Compiling Command: mingw32

Upload videos to my Youtube channel without user authentication using YoutubeApi v3 and ouath2

痴心易碎 提交于 2019-12-03 18:46:05
问题 The goal of my task is to create a console script, which will insert recently uploaded videos on my own site to my own Youtube channel. I want to use server-to-server authentication but YoutubeApi does not support this way of authentication now. So my question is: How could I upload video to youtube channel, using oauth2 authentication with console script without any help of a user? Is there any way to do this without using deprecated ClientLogin authentication protocol? 回答1: Yes this segment

Win32 C++ console clearing screen without blinking

我与影子孤独终老i 提交于 2019-12-03 16:37:28
I've seen some console games where the screen refreshes/clears itself without the annoying blinking. I've tried numerous solutions, here's what I got as of now: while(true) { if(screenChanged) //if something needs to be drawn on new position { COORD coordScreen = { 0, 0 }; DWORD cCharsWritten; CONSOLE_SCREEN_BUFFER_INFO csbi; DWORD dwConSize; HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); GetConsoleScreenBufferInfo(hConsole, &csbi); dwConSize = csbi.dwSize.X * csbi.dwSize.Y; FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten); GetConsoleScreenBufferInfo

URL Encoding in c# and Asp.net web api

点点圈 提交于 2019-12-03 16:17:41
I have an ASP.NET web api that receives web requests and returns Json data. browsing to this URL: http://1.2.3.4/api1/api/values/mypartname will return the following json string: { \"PartName\": \"mypartname\", \"PartDes\": \"53.6X53.6APA/ALIM1NOTPAK\", \"PartLocation\": \"A36\" } but when sending a part name that contains spaces or quotes like this: http://1.2.3.4/api1/api/values/my part na"me i get a 404 - File or directory not found. error. I'm consuming the json with a .NET 4 Console application like so: static void Main(string[] args) { try { string partName = "TAPE 56 3M 3/4\"";

using qt : How To Build a Gui OnTop Of a Console Application?

家住魔仙堡 提交于 2019-12-03 16:11:24
i have a console application that generated from bison (a parser) and i want to build a simple gui for it so i can send input from this gui to the console and get output from the console into the gui . i tried to do that using java process class but it doesnt work for me , please help me to do that using qt . Etienne Savard It depends on the complexity of the data you want to feed in/out of your console application. Low complexity Use some command switches that you pass from your Qt GUI to your console application. Look at the QProcess class documentation . High complexity I would go with an

Is there a way to make a console window flash in the task bar programmatically

笑着哭i 提交于 2019-12-03 16:03:18
问题 Basically I made console app that performs some task that takes a few minutes. I'd like to have it flash in the taskbar to let me know when it's done doing its thing. 回答1: Using the answer that @Zack posted and another one to find the handle of a console app I came up with this and it works great. class Program { [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] static extern bool FlashWindowEx(ref FLASHWINFO pwfi); [StructLayout(LayoutKind.Sequential)] public struct