private void Form1_Load(object sender, EventArgs e) { //this.Visible = false;//隱藏當前窗口 //this.notifyIcon1.Visible = true;//顯示任務欄的圖標 //去掉下面if就需打自定義結束password write txt? if (this.WindowState == FormWindowState.Minimized) { this.Hide(); this.Visible = false; //隱藏當前窗口 this.notifyIcon1.Visible = true; //顯示任務欄的圖標 } using (Process curProcess = Process.GetCurrentProcess()) { using (ProcessModule curModule = curProcess.MainModule) { m_pfnHookProc = new Win32API.DelHookProc(HookProc); m_hookHandle = Win32API.SetWindowsHookEx( Win32API.WH_KEYBOARD_LL, m_pfnHookProc, Win32API.GetModuleHandle(curModule.ModuleName), 0 ); } if (m_hookHandle == 0) { MessageBox.Show("呼叫 SetWindowsHookEx 失敗!"); return; } } }
private void Form1_Load(object sender, EventArgs e) { using (Process curProcess = Process.GetCurrentProcess()) { using (ProcessModule curModule = curProcess.MainModule) { m_pfnHookProc = new Win32API.DelHookProc(HookProc); m_hookHandle = Win32API.SetWindowsHookEx( Win32API.WH_KEYBOARD_LL, m_pfnHookProc, Win32API.GetModuleHandle(curModule.ModuleName), 0 ); } if (m_hookHandle == 0) { MessageBox.Show("呼叫 SetWindowsHookEx 失敗!"); return; } } }
private void Form1_Load(object sender, EventArgs e) { //this.Visible = false;//隱藏當前窗口 //this.notifyIcon1.Visible = true;//顯示任務欄的圖標 //去掉下面if就需打自定義結束password write txt? if (this.WindowState == FormWindowState.Minimized) { this.Hide(); this.Visible = false;//隱藏當前窗口 this.notifyIcon1.Visible = true;//顯示任務欄的圖標 } using (Process curProcess = Process.GetCurrentProcess()) { using (ProcessModule curModule = curProcess.MainModule) { m_pfnHookProc = new Win32API.DelHookProc(HookProc); m_hookHandle = Win32API.SetWindowsHookEx( Win32API.WH_KEYBOARD_LL, m_pfnHookProc, Win32API.GetModuleHandle(curModule.ModuleName), 0 ); } if (m_hookHandle == 0) { MessageBox.Show("呼叫 SetWindowsHookEx 失敗!"); return; } } }