본문 바로가기
반응형

→ 개발/C#30

[C#] OS버젼 알아내기 private string getOsVersion() { OperatingSystem os = Environment.OSVersion; switch (os.Platform) { //windows95이상 case PlatformID.Win32Windows: if (os.Version.Major == 4) { switch (os.Version.Minor) { case 0: osVersion = "Windows95"; break; case 10: osVersion = "Windows98"; break; case 90: osVersion = "WindowsMe"; break; } } break; //windowsNT이상 case PlatformID.Win32NT: if (os.Version.Major == 4).. 2010. 12. 24.
[C#] 레지스트리 값 불러오기 / 설정하기 불러오기 string regKeyNm = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\"; string checkservicerunning = string.Format("{0}",Registry.GetValue(regKeyNm + "W32Time", "Start", string.Empty)); 설정하기 string regKeyNm = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\"; Registry.SetValue(regKeyNm + "W32Time", "Start", 2); 2010. 12. 24.
[C#] 한번만 실행되는 프로그램 만들기 솔루션 탐색기에서 Program.cs 선택 Program.cs의 Main함수를 다음과같이. static void Main() { bool createdNew = false; Mutex dup = new Mutex(true, "File Sync Manager", out createdNew); if (createdNew) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); dup.ReleaseMutex(); } else { MessageBox.Show("이미 실행중 입니다.", "----프로그램"); return; } } 2010. 11. 30.
[C#] 확인 취소 가능한 메시지 박스 DialogResult dr = MessageBox.Show("종료하시겠습니까?", "알림", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (dr == DialogResult.OK) { MessageBox.Show("정상적으로 종료되었습니다."); } else { MessageBox.Show("종료안한다고?"); } 2010. 11. 30.
반응형