언어&프레임워크/C#

    [초보] C# C에서 쓰던 typedef 및 #define 사용하기

    C/C++에서는 이것 많이 사용하였습니다. 편하니까 그런데, C#에서는 이런거 절대로 용납이 안되더군요 ㅎㄷㄷ 그리하여 동일한 방법으로 써 보도록 하지요... 1. typedef 형태의 structure e.g. C/C++ typedef struct _header_ { unsigned char id; unsigned char number; unsigned short packet_length; unsigned short data_length; } HEADER; 이런식으로 표현하는데 C#에서는 어떻게 쓸까? 기본이 되는 namespace에서 멤버로 지정합니다. private struct HEADER { public Byte id; public Byte number; public UInt16 packetLen..

    윈도우 버젼 확인하는 방법(C#)

    Checking file versions is surprisingly hard. I was wandering around the web the other day and ran into this post. In general I don’t have many issues with the post, until you get to the bottom of the article. The author mentions that his code only runs on Win7 or newer so he helpfully included a check to make sure that his code only runs on WIn7: // Example in C#. internal bool SupportsTaskProgr..

    비정형 윈도우 만들기

    윈폼 카테고리를 만들었습니다. 제가 윈폼에 그다지 자신이 없고(다른건 자신이 있는듯... 가소롭죠? -_-), 윈폼에 관련된 다양한 테크닉이 매우 많기 때문에 윈폼쪽 글은 별로 다루지 않았었지만 용기를 내어 좀 다루어 볼까 합니다. 더불어 요즘(?) 주목을 받는 스마트 클라이언트 관련 글도 이곳 카테고리에서 다루어 볼까 합니다. 첫 번째 주제는 맛배기로 사각형이 아닌 비 정형 윈도우를 작성하는 윈폼 코드에 대한 내용입니다. Irregularly Shaped Window 뭔 넘의 블로그 제목이 이다지도 어렵냐... Irregular 라는 단어를 어휘학적으로 접근해서(쑈하구 있넹... -_-), 부정의 접두어 ir 에다가 친숙한 단어 regular, 그리고 부사형 접미어 ly 가 붙었으니... 해석하자면 r..

    Border없는 Form만들고 이동시키기

    폼을 만드는 경우 상단 FormBorderStyle을 None로 적용 하게 되는 경우가 있습니다. 대게 디자이너들이 원하는 경우가 많죠 이럴 경우 상단이든 어디든 원하는 디자인으로 만들수 있기 때문에 상당히 유용하긴 하지만... 역시 귀찮다는거는 어쩔수 없죠 디자이너에 요구사항에 맞춰주기 위해서 한번 해보겠습니다. 상단바가 없어졌기 때문에 저는 그부분을 pictureBox로 대체 하였습니다. 그리고 그 pictureBox를 이동하는대 사용하기 위해서 API를 사용하였습니다.. 이렇게 하는대 API를 사용한 이유는 코드도 간단 하고 더 빨라 보이더라구요 일단 선언부에 using System.Runtime.InteropServices; 해줘야 쓰겠죠 ㅎㅎ 그리고 전역에는 이런걸 써줬습니다. public co..

    주요 프로그램 포트

    주요 프로그램이 사용하는 포트 번호 서비스/프로그램 이름 설 명 TCP UDP 비고 FTP file transfer protocol 20(data),21(control) SSH Secure telnet 22 Telnet Remote logon 23 SMTP MTA(Mail Transfer Agent) 25 DNS Server Domain Name System Server 53 53 bootps Bootstrap Protocol Server 67 67 DHCP Server bootpc Bootstrap Protocol Client 68 68 tftp Trivial File Transfer 69 69 HTTP Web 80 HTTP Proxy Web proxy server 8080 관례 HTTPS Secure..

    [INI_Chapter3] C#에서 INI관련 함수 사용하기 2번째

    [INI_Chapter3] C#에서 INI관련 함수 사용하기 2번째

    저번 포스팅에서는 C#에서 WINAPI 함수 중 INI 파일 조작 함수를 Wrapping한 클래스에 대해 살펴 보았습니다. 이번 시간에는 실제 ini 파일을 조작 하기 위한 클래스를 소개 해 드릴까 합니다. 급하게 만든거라 허접하더래도 이해해 주시고, 그럼 레지스트리 형식의 INI 파일을 제어하는데 필요한 기능을 정의한 interface부터 살펴 보겠습니다.(첨부파일에 몇가지 내용은 본 포스팅에 게시되지 않을 수 있습니다.) /// /// Registry 형식의 파일 조작에 필요한 기능을 제공합니다. /// public interface IPrivateProfileProvider { /// /// 섹션 리스트를 가져옵니다. /// /// 섹션 문자열 배열입니다. string[] GetSectionName..

    C# ini 파일 다루기!!

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; namespace CtorSetup { public partial class Setup : Form { public Setup() { InitializeComponent(); } public class IniReadWrite { // INI Read Write를 위한 API 선언 [DllImport("kernel32.dll")] private st..

    [C#.Net] Ini 파일 사용방법

    // COM interop 및 플랫폼 호출 서비스 using System.Runtime.InteropServices; // INI Read를 위한 API 선언 [DllImport("kernel32.dll")] private static extern int GetPrivateProfileString( // INI Read String section, String key, String def, StringBuilder retVal, int size, String filePath); // INI Write를 위한 API 선언 [DllImport("kernel32.dll")] private static extern long WritePrivateProfileString( // INI Write String se..