C# 콘솔프로그램에서 콘솔창 숨기기

C# 콘솔프로그램에서 실행되는 콘솔창을 숨기기 위한 방법이다. class안에 아래와 같이 선언한다. [DllImport(“kernel32.dll”)] static extern IntPtr GetConsoleWindow(); [DllImport(“user32.dll”)] static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); const int SW_HIDE = 0; // 숨기기 const int SW_SHOW = 1; // 보이기 2.  main 함수 안에 아래의 코드를 입력한다.         var handle = GetConsoleWindow();         ShowWindow(handle, SW_HIDE); // 숨기기 […]

C#에서 ini 환경 파일 쓰는 방법

ini 환경 파일을 간단하게 만드는 방법을 알아본다.   1. initUtil 이라는 클래스를 만든 후 ini 관련 메소드를 구성한다.(iniUtil.cs) using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Runtime.InteropServices;namespace INI{     class iniUtil     {       private string iniPath;       public iniUtil(string path)        {            this.iniPath = path;  //INI 파일 위치를 생성할때 인자로 넘겨 받음       }                 [DllImport(“kernel32.dll”)]         private […]