public bool login() { if (this.monitor == null) { MessageBox.Show("未指定监控器!"); return(false); } toolStripStatusLabel.Text = "正在登陆监控控制器!"; H264_DVR_DEVICEINFO dvrdevInfo = new H264_DVR_DEVICEINFO(); int nError; int nLoginID = XMSDK.H264_DVR_Login(monitor.nvrDevice.IP, (ushort)monitor.nvrDevice.port, monitor.nvrDevice.username, monitor.nvrDevice.password, out dvrdevInfo, out nError, SocketStyle.TCPSOCKET); if (nLoginID <= 0) { int iLastErr = XMSDK.H264_DVR_GetLastError(); string str = "H264_DVR_Login failed, error code= " + iLastErr + "!登录失败,请检查配置参数,并重新启动!"; //登录失败,输出错误号 toolStripStatusLabel.Text = "H264_DVR_Login failed, error code= " + iLastErr + "!登录失败,请检查配置参数,并重新启动!"; MessageBox.Show(str); return(false); } this.monitor.nvrDevice.userID = nLoginID; XMSDK.H264_DVR_SetupAlarmChan(nLoginID); toolStripStatusLabel.Text = "就绪!"; return(true); }
public static extern Int32 H264_DVR_Login(StringBuilder sDVRIP, ushort wDVRPort, StringBuilder sUserName, StringBuilder sPassword, out H264_DVR_DEVICEINFO lpDeviceInfo, out short error, SocketStyle socketstyle);
public static extern Int32 H264_DVR_Login(string sDVRIP, ushort wDVRPort, string sUserName, string sPassword, out H264_DVR_DEVICEINFO lpDeviceInfo, out int error, SocketStyle socketstyle);
public bool login() { if(this.monitor==null){ MessageBox.Show("未指定监控器!"); return false; } toolStripStatusLabel.Text = "正在登陆监控控制器!"; H264_DVR_DEVICEINFO dvrdevInfo = new H264_DVR_DEVICEINFO(); int nError; int nLoginID = XMSDK.H264_DVR_Login(monitor.nvrDevice.IP, (ushort)monitor.nvrDevice.port, monitor.nvrDevice.username, monitor.nvrDevice.password, out dvrdevInfo, out nError, SocketStyle.TCPSOCKET); if (nLoginID <= 0) { int iLastErr = XMSDK.H264_DVR_GetLastError(); string str = "H264_DVR_Login failed, error code= " + iLastErr + "!登录失败,请检查配置参数,并重新启动!"; //登录失败,输出错误号 toolStripStatusLabel.Text = "H264_DVR_Login failed, error code= " + iLastErr + "!登录失败,请检查配置参数,并重新启动!"; MessageBox.Show(str); return false; } this.monitor.nvrDevice.userID = nLoginID; XMSDK.H264_DVR_SetupAlarmChan(nLoginID); toolStripStatusLabel.Text = "就绪!"; return true; }