728x90 ๋ฐ์ํ ๐จ๐ผ๐ป๊ฐ๋ฐ/C#23 C# - Application.Exit() ๋ช ๋ น์ด ์๋ ๊ฒฝ์ฐ (Environment.Exit(Environment.ExitCode)) Environment.Exit(Environment.ExitCode); ์ถ์ฒ: https://stackoverflow.com/questions/25050341/application-is-still-running-in-memory-after-application-exit-is-called Application is still running in memory after Application.Exit() is called The application I am building is still running in memory (checked in Task Manager) after it is closed using Application.Exit(). Because of this when I am running i.. 2022. 9. 26. C# - .NET ๋์ปดํ์ผ๋ฌ ๋ฐ ์ด์ ๋ธ๋ฆฌ ๋ธ๋ผ์ฐ์ (dotPeek) https://www.jetbrains.com/ko-kr/decompiler/ dotPeek: JetBrains๊ฐ ๋ง๋ ๋ฌด๋ฃ .NET ๋์ปดํ์ผ๋ฌ ๋ฐ ์ด์ ๋ธ๋ฆฌ ๋ธ๋ผ์ฐ์ www.jetbrains.com 2022. 9. 4. C# - setTimeout ๊ตฌํ ๋ฐฉ๋ฒ 1. Task.Delay(delay).ContinueWith((task) => { /* Code */ }); ๋ฐฉ๋ฒ 2. public void setTimeout(Action TheAction, int Timeout) { Thread t = new Thread( () => { Thread.Sleep(Timeout); TheAction.Invoke(); } ); t.Start(); } ์ถ์ฒ: https://stackoverflow.com/questions/4331149/winforms-equivalent-of-javascript-settimeout Winforms equivalent of javascript setTimeout Is there a simple solution/idea/strategy t.. 2022. 8. 28. C# - ํ๋ก์ธ์ค ์ด๋ฆ์ผ๋ก ํ๋ก์ธ์ค ์ฃฝ์ด๊ธฐ(Process) ์ฝ๋ public void killPorcesses(string pname) { Process[] processList = Process.GetProcessesByName(pname); if(processList.Length > 0) { for(int i=0; i < processList.Length; i++) { processList[i].Kill(); } } } killPorcesses("notepad"); ์ถ์ฒ: https://infodbbase.tistory.com/92 C# Process ์ฌ์ฉํ๊ธฐ #3 ( ํน์ ํ๋ก์ธ์ค ์ข ๋ฃ(Kill) ) ์๋ ํ์ธ์, ์ด๋ฒ ํฌ์คํ ์ C# ์์ Process ๋ฅผ ์ด์ฉํ์ฌ ํน์ ํ๋ก์ธ์ค๋ฅผ ์ข ๋ฃ์ํค๋ ๋ฐฉ๋ฒ์ ์ ๋ฆฌํ์์ต๋๋ค. 1. ํน์ ํ๋ก์ธ์ค ๊ฐ ์คํ ๋์ด ์์ ๊ฒฝ์ฐ.. 2022. 8. 28. C# - ๋ค๋ฅธ ํ๋ก๊ทธ๋จ ์คํ ์ํค๊ธฐ(Porcess.Start) with ์์ ๊ฒฝ๋ก ์ง์ ์์ ํ ์ค๋ก ํ๋ก๊ทธ๋จ ์คํ์ํค๊ธฐ System.Diagnostics.Process.Start(".\\Agents\\MCROAgent" + idx.ToString() + "\\clicker.exe"); ํ๋ก๊ทธ๋จ ์์ ๊ฒฝ๋ก ๋ฑ ๋ค์ํ ์ต์ ์ค์ Process process = new Process(); process.StartInfo.WorkingDirectory = "Agents\\MCROAgent" + idx.ToString(); // ์์ ๊ฒฝ๋ก process.StartInfo.FileName = "clicker.exe"; // ํ์ผ ์ด๋ฆ process.Start(); * ํ๋ก๊ทธ๋จ์ ํด๋ ๋ด์์ ์คํ์์ผ์ผ๋ง ํ ๊ฒฝ์ฐ ์ถ์ฒ: https://heon-dev.tistory.com/7 Process.Start(.. 2022. 8. 28. C# - ํ๋ก๊ทธ๋จ ์ค๋ณต ์คํ ๋ฐฉ์งํ๊ธฐ ๋ฐฉ๋ฒ 1. ํ๋ก์ธ์ค ์ด๋ฆ ์ค๋ณต ๊ฐ์ง //์ด๋ฏธ ํ๋ก๊ทธ๋จ์ด ์คํ ์ค ์ผ๋... System.Diagnostics.Process[] processes = null; string strCurrentProcess = System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToUpper(); processes = System.Diagnostics.Process.GetProcessesByName(strCurrentProcess); if (processes.Length > 1) { MessageBox.Show(string.Format("'{0}' ํ๋ก๊ทธ๋จ์ด ์ด๋ฏธ ์คํ ์ค์ ๋๋ค.", System.Diagnostics.Process.GetCurrentProcess().Pr.. 2022. 8. 26. C# - ๋ค๋ฅธ ํ๋ก์ธ์ค๋ผ๋ฆฌ ๋ฉ์์ง(string) ์ ๋ฌํ๊ธฐ(SendMessage) ์์ const int WM_COPYDATA = 0x4A; public struct COPYDATASTRUCT { public IntPtr dwData; public int cbData; [MarshalAs(UnmanagedType.LPStr)] public string lpData; } protected override void WndProc(ref Message m) { try { switch (m.Msg) { case WM_COPYDATA: COPYDATASTRUCT cds = (COPYDATASTRUCT)m.GetLParam(typeof(COPYDATASTRUCT)); MessageBox.Show(cds.lpData); break; default: base.WndProc(ref m); break;.. 2022. 8. 24. C# - ๋ค๋ฅธ ์์ฉํ๋ก๊ทธ๋จ์ ์ ์ดํด ๋ณด์. feat.SPY++ ๊ฐํน ๊ฐ๋ฐ์ ํ๋ค๋ณด๋ฉด ์ธ๋ถ ์์ฉํ๋ก๊ทธ๋จ์ ์ฐ๊ณํ๊ฑฐ๋ ์ ์ดํด์ผํ ์ผ์ด ์๋ค. ์ผ๋ฐ์ ์ผ๋ก ๋ณธ์ธ์ด ๋ง๋ (์์ค๊ฐ ์๋) ํ๋ก๊ทธ๋จ์ด๋ผ๋ฉด ์์ฝ๊ฒ ์ง๋ง ์๋๊ฒฝ์ฐ๊ฐ ๋๋ถ๋ถ์ด๋ค. ๊ทธ๋ด๋๋ Window Message๋ฅผ ์ด์ฉํ์ฌ ๋ค๋ฅธ ์์ฉํ๋ก๊ทธ๋จ์ ์ ์ดํ ์ ์๋ค. ๋ชจ๋ ์๋์ฐ ์์ฉํ๋ก๊ทธ๋จ์ ์๋์ฐ์ฆ ์์์ ๋์ํ๊ธฐ๋๋ฌธ์ ๊ณตํต๋ ๋ฉ์์ง๋ฅผ ์ด์ฉํ์ฌ ์ ์ดํ๋ ๋ฐฉ๋ฒ์ด๋ค. ์์ ๋ค์์ ๊ณ์ฐ๊ธฐ ์์ฉํ๋ก๊ทธ๋จ์ ํธ๋ค์ ์ฐพ์์ ํด๋น ํธ๋ค์ ๋ฉ์์ง๋ฅผ ๋ณด๋ด๋ ์์ ์ด๋ค. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windo.. 2022. 8. 24. C# - ์ค๋ ๋์์ ์์ ฏ ์กฐ์ํ๊ธฐ private void AggiornaContatore() { if(this.lblCounter.InvokeRequired) { this.lblCounter.BeginInvoke((MethodInvoker) delegate() {this.lblCounter.Text = this.index.ToString(); ;}); } else { this.lblCounter.Text = this.index.ToString(); ; } } Invoker ์ฌ์ฉ ์ถ์ฒ: https://stackoverflow.com/questions/14890295/update-label-from-another-thread Update label from another thread I use a thread writing in anothe.. 2022. 8. 23. C# - http ์์ฒญ(HttpWebRequest) string url = "https://ipinfo.io/ip"; //ํ ์คํธ ์ฌ์ดํธ string responseText = string.Empty; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "GET"; using (HttpWebResponse resp = (HttpWebResponse)request.GetResponse()) { HttpStatusCode status = resp.StatusCode; Console.WriteLine(status); // ์ ์์ด๋ฉด "OK" Stream respStream = resp.GetResponseStream(); using (StreamReader sr = ne.. 2022. 6. 27. C# - ๊ฐ๋จํ API ์์ฒญ & JSON ์ถ๋ ฅ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Net; using Newtonsoft.Json.Linq; namespace covidView { public partial class Form1 : Form { private const string URL = "https://api.corona-19.kr/korea/beta/"; private strin.. 2022. 2. 2. ์ด์ 1 2 ๋ค์ 728x90 ๋ฐ์ํ