728x90

Application 171

[Python] 실행 파일 만들기

우선 터미널을 열어서 > pip install pyinstaller 위의 명령어로 pyinstaller를 설치해 줍니다 그 후 작성 파일의 위치로 이동 후 pyinstaller -F -w --icon=아이콘파일명.ico 파일명.py 혹은 pyinstaller --onefile 파일명.py 명령어를 실행하면 dist폴더가 생성되며 하위 위치에 exe 파일이 생성됩니다 명령어로는 -F : 단일 파일로 생성 -w : 윈도우로 실행 --icon : 아이콘 변경 입니다 아이콘의 경우 없으면 기본값으로 아이콘 생성이 진행됩니다 제 글이 도움이 되셨다면 댓글 & 공감 부탁드려요 😀

Application/Python 2022.12.15

[C++] 정렬 되는 연결 리스트(링크드 리스트) 만들기

학번과 성적을 입력받으면 학번에 따라서 자동 정렬되는 연결 리스트 (링크드 리스트) 예제 코드 #include #include #include #define LEN sizeof(struct Student) struct Student { int num; float score; struct Student *next; }; int n = 0; void print(struct Student * head); struct Student * insert(struct Student * head, struct Student * stud) { if(head == NULL) { head = stud; } else { struct Student *temp; if(head->num > stud->num) { temp = hea..

Application/C++ 2022.12.15

[Python] Class 다중 인자 값 설정

클래스를 사용하다 보면 인자 값 개수에 따라서 다르게 동작하여야 하는 경우가 발생할 수 있습니다 이럴 경우 __call__ 함수를 이용해서 사용하면 됩니다 class calc(): g = 0 def __init__(self) -> None: pass def __call__(self, *args: int, **kwds: int) -> None: if len(args) == 1: pre = self.g self.g += args[0] return print("add_sum: {} + {} = {}".format(pre, args[0], pre + args[0])) elif len(args) == 2: self.g = args[0] + args[1] return print("add: {} + {} = {}"...

Application/Python 2022.12.14

[C# WinForm] DLL 실행 파일에 포함 하기

이전에는 dll을 실행 파일에 포함하기 위해서 dll 선택 후 [파일 속성] - [빌드 작업] - [포함 리소스] 으로 해당 파일을 포함시키고 Program.cs 파일에서 Assembly로 dll을 리소스에서 가져오는 방식으로 작업을 했다면 최신 Visual Studio의 경우에 [도구] - [NuGet 패키지 관리] - [솔루션 NuGet 패키지 관리] 를 통해 특정 패키지 하나만 추가하면 추가 작업 없이 바로 컴파일 만으로 dll을 추가 가능하게 바뀌었다 해당 패키지의 이름은 Costura.Fody 패키지이다 필자가 작성 중인 당시 버전은 5.7.0 버전이 최신 버전이고 해당 패키지를 설치하게 되면 추가 라이선스 승인 진행 후 완료가 된다 완료 후 위 캡처처럼 Costura.Fody 와 Fod..

[C# WinForm] MD5 파일 Hash 값 추출

파일의 MD5 Hash 값을 추출하고 싶다면 using System; using System.IO; using System.Security.Cryptography; private bool MD5_Hash(string strPath, ref long lFileSize, ref byte[] szMD5_hash, ref int iMD5Size) { bool bRet = false; try { FileStream fs = File.OpenRead(strPath); try { byte[] szMD5 = MD5.Create().ComputeHash(fs); Array.Copy(szMD5, 0, szMD5_hash, 0, szMD5.Length); lFileSize = fs.Length; iMD5Size = szMD..

[C# WinForm] Property 사용 (get & set)

클래스 함수를 사용 중 지역 변수의 값을 수정 혹은 참조하고 싶다면 C# 프로퍼티의 get과 set을 사용하면 된다 사용 법의 경우 아래와 같다 private bool m_bFlag; private string m_strData; public bool IsFlag { get { return m_bFlag; } set { m_bFlag = value; } } public string GetData { get { return m_strData; } } public string SetData { set { m_strData = value; } } 위와 같이 IsFlag 와 같이 한 곳에서 선언하여 사용할 수도 있고 GetData 혹은 SetData 처럼 다르게 선언하여 사용 가능하다 내부에서만 변수를 수정하고..

[C# WinForm] Delegate, Event, Invoke, Cross Thread 사용법

Main Form 외 다른 Class 선언 후 해당 클래스에 추가 Thread로 동작을 하고 있을 시 Main Form의 컨트롤을 제어하고 싶다면 아래처럼 코드를 설계하면 Cross Thread 오류가 나지 않는다 Class 영역 public class MainModule { public delegate void _Delegate(string strMsg); public event _Delegate EventDelegate; private Thread m_h1; public MainModule() { } public bool ServerStart() { m_h1 = new Thread(new ThreadStart(Proc)); m_h1.Start(); } public void ServerStop() { ..

[C# WinForm] INI 파일 읽기 및 쓰기

C# 에서 INI 파일을 읽고 쓰기 위해선 kernel32.dll을 import 하여 사용 하여야 한다 간단한 사용 방법을 예제로 올려본다 using System.Runtime.InteropServices; public class Module { private string m_strINIPath = Application.StartupPath + @"\info.ini"; [DllImport("kernel32")] private static extern long WritePrivateProfileString(string strSection, string strKey, string strVal, string strFilePath); [DllImport("kernel32")] private static exte..

[C# WinForm] 프로그램 광고 달기 (Ads Jumbo)

기본적인 광고의 경우 구글에서 지원하는 광고를 많이 쓴다 (수익이 다른 곳에 비해 좋다) 예를 들어 웹에서는 Google AdSense를 달아서 광고를 하고 모바일 앱에서는 Google AdMob을 이용해 광고를 한다 하지만 윈도우 프로그램에서는 광고 제공을 하지 않고 있다 우회적으로 윈도우 프로그램에 IE을 달아서 할 수도 있지만 기본적으로 윈도우 프로그램에서 광고를 달 수 있게 해주는 패키지를 소개한다 사이트 명은 제목에서 적은 AdsJumbo.com 이라는 곳이다 https://adsjumbo.com/ AdsJumbo.com: Windows App Monetization & Advertising for UWP apps Monetize your Windows 10 apps & games with be..

728x90
반응형