[C#] WinForm 시스템 메뉴에 나만의 메뉴 추가하기

using System; using System.Windows.Forms; using System.Runtime.InteropServices; namespace CaptionTimetableSupporet { public partial class MainForm : Form { // P/Invoke constants private const int WM_SYSCOMMAND = 0x112; private const int MF_STRING = 0x0; private const int MF_SEPARATOR = 0x800; // P/Invoke declarations [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);…

[C#] Environment 를 통해 시스템 정보, OS 버전알아오기

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; namespace WindowsFormsApplication2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { // 현재 작업 디렉터리의 정규화된 경로를 가져오거나 설정합니다. txtWindowCode.Text += "@ 디렉토리 경로 : "…

[C#] 윈도우 OS 정보 얻기

OperatingSystem os = System.Environment.OSVersion; Console.WriteLine("플랫폼 : " + os.Platform); Console.WriteLine("서비스팩 : " + os.ServicePack); Console.WriteLine("버전 : " + os.Version); Console.WriteLine("버전 : " + os.Version); Console.WriteLine("버전 문자열 : " + os.VersionString); Console.WriteLine("CLR버전 : " + System.Environment.Version); Console.ReadLine(); // 콘솔에서 확인할수 있도록 잠시 멈춤 사용자의 정보를 획득해야 될 일이 있을 경우에 위 기능을 사용해서 처리 할 수…

[C/C++] 시간표시

#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <time.h> int main() { time_t timer; struct tm* t; timer = time(NULL); // 현재 시각을 초 단위로 얻기 t = localtime(&timer); // 초 단위의 시간을 분리하여 구조체에 넣기 printf("%d", t->tm_year + 1900); //현재 년 printf("%d", t->tm_mon + 1); //현재 월 printf("%d", t->tm_mday); //현재 일 printf("%d:", t->tm_hour); //현재 시 printf("%d:", t->tm_min);…

[C#] Picturebox를 투명하게

LicenseLabel.Parent = pictureBox1; LicenseLabel.BackColor = Color.Transparent; LicenseLabel.BringToFront(); LicenseLabel.BackColor = Color.Transparent; LicenseLabel.Width = this.Width; LicenseLabel.Left = 0; LicenseLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; LicenseLabel.Parent = pictureBox1;

[C#] WebBrowser version 변경

Program.cs 에서 다음을 사용하도록 합니다. using System.Runtime.InteropServices; using Microsoft.Win32; 레지스트리에 세팅하고 값이 정상적인지 체크하도록 하는 함수 입니다. private static void SetIEVersioneKeyforWebBrowserControl(string appName, int ieval) { string RegKeyPath = ""; RegistryKey Regkey = null; try { // x86, x64 구분 if (Environment.Is64BitProcess) { RegKeyPath = @"SOFTWARE\WOW6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION"; } else { RegKeyPath = @"SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION"; } //…

[C#] 폰트 설치 여부 체크해서 설정 도와주기

class FontLibraryClass { public class FontLibrary { private string FontsFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Fonts); private static FontLibrary inst = new FontLibrary(); public PrivateFontCollection privateFont = new PrivateFontCollection(); /// <summary> /// /// </summary> public static FontFamily[] Families { get { return inst.privateFont.Families; } } /// <summary> /// /// </summary> public FontLibrary() { AddFontFromNanumgothic(); } /// <summary> /// 리소스에…

[C#] 관리자 권한으로 실행하기

[C#] 관리자 권한으로 실행하기
해당 작업은 Program.cs 에서 작업을 합니다. using System.Security.Principal; using System.Diagnostics; /// <summary> /// 관리자 권한 체크 /// </summary> /// <returns></returns> public static bool IsAdministrator() { WindowsIdentity identity = WindowsIdentity.GetCurrent(); if (null != identity) { WindowsPrincipal principal = new WindowsPrincipal(identity); return principal.IsInRole(WindowsBuiltInRole.Administrator); } return false; } 메인 실행전에 관리자 권한으로 실행 하도록 하면 됩니다. [STAThread] static…

[MySQL] 상태가 sleep 인것 정리하기

#!/bin/sh NOW=$(date +"%m-%d-%Y") FILE="/root/sleep_processes.$NOW.txt" /var/lib/mysql-5.1.40/bin/mysql -uroot --password='password' -e "select concat('KILL ',id,';') into outfile '/tmp/sleep_processes.txt' from information_schema.processlist where State = 'User sleep'" /var/lib/mysql-5.1.40/bin/mysql -uroot --password='password' -e "source /tmp/sleep_processes.txt;" if [ -s "/tmp/sleep_processes.txt" ]; then cp /tmp/sleep_processes.txt $FILE fi rm -f /tmp/sleep_processes.txt https://www.phpschool.com/gnuboard4/bbs/board.php?bo_table=tipntech&wr_id=81951&page=2