//CCD1相机打开
OpenFramegrabber("DahengCAM", 1, 1, 0, 0, 0, 0, "interlaced", 8, "gray", -1, "false",
"HV-13xx", "1", 1, -1, &hv_AcqHandle_CCD1);
//CCD1相机准备采集
GrabImageStart(hv_AcqHandle_CCD1, -1);
GrabImageAsync(&ho_Image_UP, hv_AcqHandle_CCD1, -1);
GetImageSize(ho_Image_UP, &hv_Width_CCD1, &hv_Height_CCD1);
if (HDevWindowStack::IsOpen())
SetPart(HDevWindowStack::GetActive(), 0, 0, hv_Height_CCD1 - 1, hv_Width_CCD1 - 1);
//CCD1显示窗口大小设置
HTuple hv_Expection;
//CCD1显示窗口不为空,则关闭窗口
if (m_CCD1 != 0)
{
HDevWindowStack::SetActive(hv_WindowHandle);
ClearWindow(HDevWindowStack::GetActive());
m_CCD1 = FALSE;
CString str;
str.Format(_T("CCD1窗口已清空"), str);
m_status.SetPaneText(0, str, TRUE);
}
//CCD1显示窗口为空,则打开窗口显示
if (m_CCD1 == 0)
{
m_CCD1 = TRUE;
HWND CCD1_hwndl;
CRect Rect_CCD1;
GetDlgItem(IDC_CCD1_Picture_Show)->GetWindowRect(&Rect_CCD1);
CCD1_hwndl = GetDlgItem(IDC_CCD1_Picture_Show)->m_hWnd;
Hlong lWWindow_CCD1_ID = (Hlong)CCD1_hwndl;
Width = Rect_CCD1.Width();
Height = Rect_CCD1.Height();
OpenWindow(0, 0, Width, Height, lWWindow_CCD1_ID, "", "", &hv_WindowHandle);
HDevWindowStack::Push(hv_WindowHandle);
HDevWindowStack::SetActive(hv_WindowHandle);
//if (HDevWindowStack::IsOpen())
DispObj(ho_Image_UP, hv_WindowHandle);
UpdateData(TRUE);
CString str;
str.Format(_T("CCD1窗口已显示"), str);
m_status.SetPaneText(0, str, TRUE);
}
//关闭相机CCD1句柄
CloseFramegrabber(hv_AcqHandle_CCD1);
//使得匹配按键可用
::EnableWindow(GetDlgItem(IDC_Picture_Match)->GetSafeHwnd(), TRUE);
}
//CCD2采集按钮的程序
void CCounterPointsDlg::OnBnClickedCcd2PictureGet()
{
// TODO: 在此添加控件通知处理程序代码
//CCD2相机打开
OpenFramegrabber("DahengCAM", 1, 1, 0, 0, 0, 0, "interlaced", 8, "gray", -1, "false",
"HV-13xx", "2", 1, -1, &hv_AcqHandle_CCD2);
//CCD2相机准备采集
GrabImageStart(hv_AcqHandle_CCD2, -1);
GrabImageAsync(&ho_Image_DOWN, hv_AcqHandle_CCD2, -1);
GetImageSize(ho_Image_DOWN, &hv_Width_CCD2, &hv_Height_CCD2);
if (HDevWindowStack::IsOpen())
SetPart(HDevWindowStack::GetActive(), 0, 0, hv_Height_CCD2 - 1, hv_Width_CCD2 - 1);
//CCD1显示窗口大小设置
//CCD1显示窗口不为空,则关闭窗口
if (m_CCD2 != 0)
{
HDevWindowStack::SetActive(hv_WindowHandle1);
ClearWindow(HDevWindowStack::GetActive());
m_CCD2 = FALSE;
CString str;
str.Format(_T("CCD2窗口已清空"), str);
m_status.SetPaneText(0, str, TRUE);
}
//CCD1显示窗口为空,则打开窗口显示
if (m_CCD2 == 0)
{
m_CCD2 = TRUE;
HWND CCD2_hwndl;
CRect Rect_CCD2;
GetDlgItem(IDC_CCD2_Picture_Show)->GetWindowRect(&Rect_CCD2);
CCD2_hwndl = GetDlgItem(IDC_CCD2_Picture_Show)->m_hWnd;
Hlong lWWindow_CCD2_ID = (Hlong)CCD2_hwndl;
Width = Rect_CCD2.Width();
Height = Rect_CCD2.Height();
OpenWindow(0, 0, Width, Height, lWWindow_CCD2_ID, "", "", &hv_WindowHandle1);
HDevWindowStack::Push(hv_WindowHandle1);
HDevWindowStack::SetActive(hv_WindowHandle1);
//if (HDevWindowStack::IsOpen())
DispObj(ho_Image_DOWN, hv_WindowHandle1);
UpdateData(TRUE);
CString str;
str.Format(_T("CCD2窗口显示"), str);
m_status.SetPaneText(0, str, TRUE);
}
//关闭相机CCD2句柄
CloseFramegrabber(hv_AcqHandle_CCD2);