private void CustomSelectSource_Load(object sender, EventArgs e) { sourceSelected = false; DTWAIN_ARRAY SourceArray = 0; TwainAPI.DTWAIN_EnumSources(ref SourceArray); int nCount = TwainAPI.DTWAIN_ArrayGetCount(SourceArray); if (nCount <= 0) { Close(); } // Display the sources DTWAIN_SOURCE CurSource = 0; for (int i = 0; i < nCount; ++i) { StringBuilder szName = new StringBuilder(256); TwainAPI.DTWAIN_ArrayGetAtLong(SourceArray, i, ref CurSource); TwainAPI.DTWAIN_GetSourceProductName(CurSource, szName, 255); listSources.Items.Add(szName.ToString()); } listSources.SelectedIndex = 0; // Display Info about sources string sText = nCount.ToString() + " TWAIN Source(s) Available for Selection"; editSourceInfo.Text = sText; }
private void SourcePropertiesDlg_Load(object sender, EventArgs e) { StringBuilder szInfo = new StringBuilder(256); TwainAPI.DTWAIN_GetSourceProductName(m_Source, szInfo, 255); this.edProductName.Text = szInfo.ToString(); TwainAPI.DTWAIN_GetSourceProductFamily(m_Source, szInfo, 255); this.edFamilyName.Text = szInfo.ToString(); TwainAPI.DTWAIN_GetSourceManufacturer(m_Source, szInfo, 255); this.edManufacturer.Text = szInfo.ToString(); TwainAPI.DTWAIN_GetSourceVersionInfo(m_Source, szInfo, 255); this.edVersionInfo.Text = szInfo.ToString(); int lMajor = 0, lMinor = 0; TwainAPI.DTWAIN_GetSourceVersionNumber(m_Source, ref lMajor, ref lMinor); string sVersion = lMajor.ToString() + "." + lMinor.ToString(); this.edVersion.Text = sVersion; DTWAIN_ARRAY AllCaps = 0; int Val = 0; TwainAPI.DTWAIN_EnumSupportedCaps(m_Source, ref AllCaps); int nSize = TwainAPI.DTWAIN_ArrayGetCount(AllCaps); for (int i = 0; i < nSize; ++i) { // get the cap value TwainAPI.DTWAIN_ArrayGetAtLong(AllCaps, i, ref Val); // get the name from the cap TwainAPI.DTWAIN_GetNameFromCap(Val, szInfo, 255); this.listCaps.Items.Add(szInfo.ToString()); } this.edTotalCaps.Text = nSize.ToString(); TwainAPI.DTWAIN_EnumCustomCaps(m_Source, ref AllCaps); this.edCustomCaps.Text = TwainAPI.DTWAIN_ArrayGetCount(AllCaps).ToString(); TwainAPI.DTWAIN_EnumExtendedCaps(m_Source, ref AllCaps); this.edExtendedCaps.Text = TwainAPI.DTWAIN_ArrayGetCount(AllCaps).ToString(); }