본문 바로가기

C# WinAPI - KeyEvent [DllImport("user32.dll")] public static extern void keybd_event(uint vk, uint scan, uint flags, uint extraInfo); [DllImport("user32.dll")] private static extern uint MapVirtualKey(int wCode, int wMapType); // ex) const byte AltKey = 18; const int KEYUP = 0x0002; int Info=0; keybd_event(AltKey, 0, 0, ref Info); // ALT key 다운 keybd_event(AltKey, 0, KEYUP, ref Info); // ALT key 업 // F4 // keydown 0..
C# OleDb Access to DataGridView Update(Save) : ComboBox.Text string _strConn = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + OpenFilePathName + ";"; using (OleDbConnection _OleConn = new OleDbConnection(_strConn)) { _OleConn.Open(); string _StrCmd = "UPDATE " + comboBox1.Text + " SET GOLD='" + txtGold.Text + "' WHERE ID='" + txtID.Text + "'"; OleDbCommand _OleCmd = new OleDbCommand(_StrCmd, _OleConn); _OleCmd.ExecuteNonQuery(); if (_OleConn.State ==..
C# OleDb Access to DataGridView Open. Table list ComboBox // Access open to Table Read OpenFileDialog _Ofd = new OpenFileDialog(); _Ofd.Filter = "Access File (*.accdb)|*.accdb"; if (_Ofd.ShowDialog() == DialogResult.OK) { string OpenFilePathName = _Ofd.FileName; try { //"Provider=Microsoft.Jet.OLEDB.4.0;DataSource='d:\\Project\\database\\Program.mdb'"; string _StrConn = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + OpenFilePathName + ";"; using (..
C# OleDb Excel to DataGridView Update(Save) string _strConn = "Provider = Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + OpenFilePathName + ";" + "Extended Properties='Excel 12.0;HDR=NO'"; using (OleDbConnection _OleConn = new OleDbConnection(_strConn)) { _OleConn.Open(); string _StrCmd = "UPDATE [Sheet1$] SET F6='" + txtGold.Text + "' WHERE F2='" + txtID.Text + "'"; OleDbCommand _OleCmd = new OleDbCommand(_StrCmd, _OleConn); _OleCmd.Execu..
C# OleDb Excel to DataGridView Open OpenFileDialog _Ofd = new OpenFileDialog(); _Ofd.Filter = "Excel File (*.xlsx)|*.xlsx"; if (_Ofd.ShowDialog() == DialogResult.OK) { string _Path = OpenFilePathName = _Ofd.FileName; try { string _StrConn = "Provider = Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + _Path + ";Mode=ReadWrite|Share Deny None;" + "Extended Properties='Excel 12.0 XML;HDR=YES;IMEX=1';"; using (OleDbConnection _OleConn = ..
C# Hide Process private const int SW_HIDE = 0; private const int SW_SHOW = 5; [DllImport("User32")] private static extern int ShowWindow(int hwnd, int nCmdShow); //WORKING private void button1_Click(object sender, EventArgs e) { int hWnd; Process[] processRunning = Process.GetProcesses(); foreach (Process pr in processRunning) { if (pr.ProcessName == "notepad") { hWnd = pr.MainWindowHandle.ToInt32(); ShowWindow..
C# input Keyboard public static void Send (string keys); SendKeys.Send("asd"); SendKeys.Send("{F1}"); SendKeys.Send("^c"); KeyCode BACKSPACE {BACKSPACE}, {BS}, or {BKSP} BREAK {BREAK} CAPS LOCK {CAPSLOCK} DEL or DELETE {DELETE} or {DEL} DOWN ARROW {DOWN} END {END} ENTER {ENTER}or ~ ESC {ESC} HELP {HELP} HOME {HOME} INS or INSERT {INSERT} or {INS} LEFT ARROW {LEFT} NUM LOCK {NUMLOCK} PAGE DOWN {PGDN} PAGE UP {PGUP..
C# WinAPI - Mouse_Event [DllImport("user32.dll")] static extern void mouse_event(uint dwFlags, uint dx, uint dy, int dwData, int dwExtraInfo); [DllImport("user32.dll")] // 커서 위치 제어 static extern int SetCursorPos(int x, int y); private const uint LMB_DOWN = 0x00000002;// Left Mouse Button Down private const uint LMB_UP = 0x00000004;// Left Mouse Button Up private const uint RMB_DOWN = 0x00000008;// Right Mouse Button Do..