Esempio n. 1
0
/*
Called to display a dialog box to select the Twain source to use.
This can be overridden if a list of all sources is available
to the application. These sources can be enumerated by Twain.
it is not yet supportted by CTwain.
*/
BOOL CTwain::SelectSource()
{
	memset(&m_Source,0,sizeof(m_Source));
	if(!SourceSelected())
	{
		SelectDefaultSource();
	}
	if(CallTwainProc(&m_AppId,NULL,DG_CONTROL,DAT_IDENTITY,MSG_USERSELECT,&m_Source))
	{
		m_bSourceSelected = TRUE;
	}
	return m_bSourceSelected;
}
Esempio n. 2
0
/*
Opens a Data Source supplied as the input parameter
*/
BOOL CTwain::OpenSource(TW_IDENTITY *pSource)
{
	if(pSource) 
	{
		m_Source = *pSource;
	}
	if(DSMOpen())
	{
		if(!SourceSelected())
		{
			SelectDefaultSource();
		}
		m_bDSOpen = CallTwainProc(&m_AppId,NULL,DG_CONTROL,DAT_IDENTITY,MSG_OPENDS,(TW_MEMREF)&m_Source);
	}
	return DSOpen();
}
Esempio n. 3
0
BOOL EVOpenDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  在此添加额外的初始化
	if(!SelectDefaultSource())
	{
		MessageBox(_T("未检测到扫描仪!"));
		OnCancel();
		return TRUE;
	}
	m_bTwainConfig = false;

	OnBnClickedButtonconfig();
	if ( !m_bTwainConfig )
	{
		int iReturn=MessageBox(_T("未检测到扫描仪或扫描仪扫描失败!\r\n是否手动选择扫描仪"),"注意",MB_YESNO|MB_DEFBUTTON2);
		if ( iReturn==IDNO )
		{
			OnCancel();
			return TRUE;
		}
		else
		{
			if(!SelectSource())
			{
				MessageBox(_T("未检测到扫描仪!"));
				OnCancel();
				return TRUE;
			}
			m_bTwainConfig = false;
			OnBnClickedButtonconfig();

			if ( !m_bTwainConfig )
			{
				MessageBox(_T("未检测到扫描仪或扫描仪扫描失败!"));
				OnCancel();
				return TRUE;
			}

		}
	}

	CWnd *pWnd = GetDlgItem(IDC_NEWEDIT3);
	CRect rc;
	if(!pWnd) return TRUE;
	pWnd->GetWindowRect(rc);
	pWnd->DestroyWindow(); //pWnd was just a placeholder;
	ScreenToClient(rc);
	m_DateTime.Create(WS_CHILD|WS_VISIBLE|DTS_LONGDATEFORMAT,rc,this,IDC_NEWEDIT3);
	m_DateTime.SendMessage((UINT)DTM_SETSYSTEMTIME,GDT_NONE, NULL);

	CString caption = EVUtil::GetInstance().ODBCGetConfig(_T("select * from Config where 所属界面='扫描界面' and 类型='标题' "));
	SetWindowText(caption);
	CString user = EVUtil::GetInstance().ODBCGetConfig(_T("select * from Config where 所属界面='扫描界面' and 类型='用户' "));
	SetDlgItemText(IDC_NEWSTATICUSER,user);
	InitInfos();

	SetDlgItemText(IDC_NEWEDIT1,"");
	CString szLJBH = EVUtil::GetInstance().ODBCGetConfig(_T("select * from Config where 所属界面='扫描界面' and 类型='零件编号' "));
	SetDlgItemText(IDC_NEWEDIT2,szLJBH);
	SetDlgItemText(IDC_NEWEDIT3,"");

	INIT_EASYSIZE;

	int   nCX   =   GetSystemMetrics(SM_CXSCREEN);
	int   nCY   =   GetSystemMetrics(SM_CYSCREEN);
	nCY = nCY-40;
	nCY = MIN(nCY,nCX);
	CRect   rtDlg;
	GetWindowRect(&rtDlg); 
	SetWindowPos(NULL,(nCX-nCY)/2,0,nCY,nCY,SWP_NOZORDER);//*/

	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}