console-application

how to run a winform from console application?

混江龙づ霸主 提交于 2019-12-27 10:18:34
问题 How do I create, execute and control a winform from within a console application? 回答1: The easiest option is to start a windows forms project, then change the output-type to Console Application. Alternatively, just add a reference to System.Windows.Forms.dll, and start coding: using System.Windows.Forms; [STAThread] static void Main() { Application.EnableVisualStyles(); Application.Run(new Form()); // or whatever } The important bit is the [STAThread] on your Main() method, required for full

how to run a winform from console application?

强颜欢笑 提交于 2019-12-27 10:18:30
问题 How do I create, execute and control a winform from within a console application? 回答1: The easiest option is to start a windows forms project, then change the output-type to Console Application. Alternatively, just add a reference to System.Windows.Forms.dll, and start coding: using System.Windows.Forms; [STAThread] static void Main() { Application.EnableVisualStyles(); Application.Run(new Form()); // or whatever } The important bit is the [STAThread] on your Main() method, required for full

Open external program

别等时光非礼了梦想. 提交于 2019-12-25 18:44:18
问题 I've been trying to open an external program like Editor for example in C. I've searched for hours but haven't found a way to open external executables, e.g. open Skype or so from the Console Application. This is my code so far: /* fopen1.c */ #include <Windows.h> #include <windows.h> #include <stdio.h> #include <stdlib.h> int main(int) { FILE *fp; fp = fopen("C://Users/Jonte/Desktop/Skype.exe", "r"); } How can I open external files? Thank you, Sincerely, Behring 回答1: One possible way -

C# modify console font, font size at runtime?

此生再无相见时 提交于 2019-12-25 18:24:43
问题 I'm in the process of creating a rougelike and to assure my game displays correctly I am wanting to change the console font and font size at runtime. I am very noob to programming and c# so I'm hoping this can be explained in a way I or anyone else can easily implement. This resource list the full syntax of the CONSOLE_FONT_INFOEX structure: typedef struct _CONSOLE_FONT_INFOEX { ULONG cbSize; DWORD nFont; COORD dwFontSize; UINT FontFamily; UINT FontWeight; WCHAR FaceName[LF_FACESIZE]; }

Calling stored procedure values into the console application C#

狂风中的少年 提交于 2019-12-25 14:22:51
问题 I have a stored procedure that its been called by a console application in C#. The stored procedure has some required parameters to be executed. What I am trying to achieve its to be able to enter one of the required parameters into the console once the console is executed. Something like having a text into the console asking to enter the project name and then hit on enter. Here's my code: try { using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager

Search files based on the date modified entered by user in console application VB.NET

点点圈 提交于 2019-12-25 13:57:19
问题 i been given a assignment to create one console application using VB.NET. The assignment will able to open the file that based on the date modified entered by user. can anyone help me to solve my problem. I'm new in vb.net and most of the tutorial are using C# . together i put the latest code i has already done but still if i put the date modified the error file will display . Thank you in advance Imports System.IO Module Module3 Sub Main() While True ' Read value. Dim s As DateTime = Console

Search files based on the date modified entered by user in console application VB.NET

我只是一个虾纸丫 提交于 2019-12-25 13:52:35
问题 i been given a assignment to create one console application using VB.NET. The assignment will able to open the file that based on the date modified entered by user. can anyone help me to solve my problem. I'm new in vb.net and most of the tutorial are using C# . together i put the latest code i has already done but still if i put the date modified the error file will display . Thank you in advance Imports System.IO Module Module3 Sub Main() While True ' Read value. Dim s As DateTime = Console

FreeConsole then AttachConsole not working

跟風遠走 提交于 2019-12-25 07:59:07
问题 I'm working with a C++ Console Application in Visual Studio 2013, working on Windows. First I detached the console using FreeConsole, it works; then, I tried to attach it back using AttachConsole, but nothing happened -- #include <psapi.h> DWORD winpid = GetCurrentProcessId(); // get pid std::cout << winpid; // it works FreeConsole(); // console lost std::cout << "Lost to the bit bucket"; //nothing happen, as expected AttachConsole(winpid); // try find the console back.... std::cout << "c"; /

How to show/hide a console window app?

这一生的挚爱 提交于 2019-12-25 07:46:55
问题 I have a small console app. I want to hide its window when it is called from my main program (with -hide as command line parameter) and show it when the user starts it (no command line param). This question suggests that using {$APPTYPE GUI} instead of {$APPTYPE CONSOLE} will hide the window. And indeed it works. But how do I make the window visible when ran by user? Purpose: I want my main program to interact with the console app silently in the background (console is invisible). So, when

Use Keyboard.IsKeyDown in C# console application

梦想的初衷 提交于 2019-12-25 07:45:07
问题 I'm writing an console application witch Displaying certain data on the console screen, than checking for user input from the keyboard and finally handleing it by need. all single threaded. For that i tried using Keyboard.IsKeyDown Method from System.Windows.Input namespace. and visual studio wo'nt allow it. Does anyone knows why and can help me? I dont see other way implementing that logic using only one thread and no timer's. 回答1: Use Console.ReadKey() to read input from the keyboard in a