public Form1() { InitializeComponent(); HkinitSDK = CHCNetSDK.NET_DVR_Init(); if (HkinitSDK == false) { MessageBox.Show("检查设备是否打开或者ip,用户名密码是否正确"); return; } KeyHook.RegisterHotKey(Handle, 100, KeyHook.KeyModifiers.Shift, Keys.S); //注册快捷键 KeyHook.RegisterHotKey(Handle, 101, KeyHook.KeyModifiers.Shift, Keys.V); //注册快捷键 Thread WaterThread = new Thread(Start_View); //创建新线程 WaterThread.Start(); //开始 }
/// <summary> /// 清理所有正在使用的资源。 /// </summary> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> protected override void Dispose(bool disposing) { if (m_lRealHandle >= 0) { CHCNetSDK.NET_DVR_StopRealPlay(m_lRealHandle); } if (m_lUserID >= 0) { CHCNetSDK.NET_DVR_Logout(m_lUserID); } if (HkinitSDK == true) { CHCNetSDK.NET_DVR_Cleanup(); } //注销热键设定 KeyHook.UnregisterHotKey(Handle, 100); KeyHook.UnregisterHotKey(Handle, 101); if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); }