示例#1
1
BOOL CSingleCamDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动
	//  执行此操作
	SetIcon(m_hIcon, TRUE);			// 设置大图标
	SetIcon(m_hIcon, FALSE);		// 设置小图标

	// TODO: 在此添加额外的初始化代码
	//此处需要对SDK进行init初始化
	NET_DVR_Init();

	NET_DVR_SetLogToFile(3, "C:\\SdkLog\\", TRUE);

	isLogin = FALSE;
	isPlaying = FALSE;

	hPlayWnd1 = GetDlgItem(IDC_ViewWindow)->m_hWnd;  //在程序初始化的时候就获取播放窗口的句柄
	hPlayWnd2 = GetDlgItem(IDC_ViewWindow2)->m_hWnd;
	m_ctrlDeviceIP1.SetAddress(192, 168, 3, 21);
	m_ctrlDeviceIP2.SetAddress(192, 168, 3, 22);
	GetDlgItem(IDC_BTN_PlayCam)->EnableWindow(FALSE); //初始状态,播放\停止和抓图按钮都是失能的 
	GetDlgItem(IDC_BTN_StopCam)->EnableWindow(FALSE); 
	GetDlgItem(IDC_BTN_SavePicture)->EnableWindow(FALSE);
	GetDlgItem(IDC_BTN_SavePicture2)->EnableWindow(FALSE);
	GetDlgItem(IDC_BTN_SaveRealData)->EnableWindow(FALSE);
	GetDlgItem(IDC_BTN_StopSave)->EnableWindow(FALSE);

	return TRUE;  // 除非将焦点设置到控件,否则返回 TRUE
}
示例#2
0
int cgiMain(void)
{
	char *ip;
	ip = (char *) calloc(32, sizeof(char));

	//初始化
	NET_DVR_Init();

	NET_DVR_SetLogToFile(3,"./sdkLog");

	//设置链接时间与重连时间
	NET_DVR_SetConnectTime(2000,1);
	NET_DVR_SetReconnect(10000,true);

	//注册设备
	LONG lUserID;
	NET_DVR_DEVICEINFO_V30 struDevice;
	//strcpy(ip,GetIP());
	lUserID = NET_DVR_Login_V30("192.168.1.64""",8000,"admin","12345",&struDevice);
	if(lUserID < 0)
	{
		printf("Login in ERROR:%d\n",NET_DVR_GetLastError());
		NET_DVR_Cleanup();
		return 1;
	}
	printf("login success!\n");
	free(ip);
	
	cgiHeaderContentType("Text/html");
	//while(1){
		if(cgiFormSubmitClicked("reboot") == cgiFormSuccess)
		{
			TestRebootDVR(lUserID);
		}

		if(cgiFormSubmitClicked("Alarm") == cgiFormSuccess)
		{
			if(Demo_Alarm() == HPR_ERROR)
				goto EXIT;
		}
		
		if(cgiFormSubmitClicked("record") == cgiFormSuccess)
		{
			if(record() == HPR_ERROR)
				goto EXIT;
		}
	//}
	
EXIT:
	NET_DVR_Logout_V30(lUserID);
	NET_DVR_Cleanup();

	return 0;
}