mirror of
https://github.com/soukoku/ntwain.git
synced 2025-04-05 20:59:23 +08:00
255 lines
6.3 KiB
HTML
255 lines
6.3 KiB
HTML
<html>
|
||
|
||
<head>
|
||
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
|
||
<meta name=Generator content="Microsoft Word 10 (filtered)">
|
||
<title>Here is some sample code for how to change cameras using the DG_CONTROL
|
||
/ DAT_FILESYSTEM operations</title>
|
||
|
||
<style>
|
||
<!--
|
||
/* Style Definitions */
|
||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||
{margin:0in;
|
||
margin-bottom:.0001pt;
|
||
font-size:12.0pt;
|
||
font-family:"Times New Roman";}
|
||
h1
|
||
{margin-top:6.0pt;
|
||
margin-right:0in;
|
||
margin-bottom:3.0pt;
|
||
margin-left:0in;
|
||
text-align:justify;
|
||
text-indent:0in;
|
||
page-break-before:always;
|
||
page-break-after:avoid;
|
||
font-size:18.0pt;
|
||
font-family:"Times New Roman";}
|
||
h2
|
||
{margin-top:6.0pt;
|
||
margin-right:0in;
|
||
margin-bottom:6.0pt;
|
||
margin-left:0in;
|
||
text-indent:0in;
|
||
page-break-after:avoid;
|
||
font-size:14.0pt;
|
||
font-family:"Times New Roman";}
|
||
h3
|
||
{margin-top:6.0pt;
|
||
margin-right:0in;
|
||
margin-bottom:3.0pt;
|
||
margin-left:0in;
|
||
text-indent:0in;
|
||
page-break-after:avoid;
|
||
font-size:12.0pt;
|
||
font-family:"Times New Roman";}
|
||
h4
|
||
{margin-top:12.0pt;
|
||
margin-right:0in;
|
||
margin-bottom:3.0pt;
|
||
margin-left:0in;
|
||
text-indent:0in;
|
||
page-break-after:avoid;
|
||
font-size:14.0pt;
|
||
font-family:"Times New Roman";}
|
||
p.MsoBodyText2, li.MsoBodyText2, div.MsoBodyText2
|
||
{margin-top:0in;
|
||
margin-right:0in;
|
||
margin-bottom:6.0pt;
|
||
margin-left:0in;
|
||
line-height:200%;
|
||
font-size:12.0pt;
|
||
font-family:"Times New Roman";}
|
||
p.MsoBodyText3, li.MsoBodyText3, div.MsoBodyText3
|
||
{margin-top:0in;
|
||
margin-right:0in;
|
||
margin-bottom:6.0pt;
|
||
margin-left:0in;
|
||
font-size:8.0pt;
|
||
font-family:"Times New Roman";}
|
||
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
|
||
{margin:0in;
|
||
margin-bottom:.0001pt;
|
||
font-size:10.0pt;
|
||
font-family:"Courier New";}
|
||
p.Style4, li.Style4, div.Style4
|
||
{margin-top:6.0pt;
|
||
margin-right:0in;
|
||
margin-bottom:3.0pt;
|
||
margin-left:0in;
|
||
text-align:justify;
|
||
text-indent:0in;
|
||
page-break-before:always;
|
||
page-break-after:avoid;
|
||
font-size:18.0pt;
|
||
font-family:"Times New Roman";
|
||
font-weight:bold;}
|
||
p.Style2, li.Style2, div.Style2
|
||
{margin-top:6.0pt;
|
||
margin-right:0in;
|
||
margin-bottom:6.0pt;
|
||
margin-left:0in;
|
||
page-break-after:avoid;
|
||
font-size:14.0pt;
|
||
font-family:"Times New Roman";
|
||
font-weight:bold;
|
||
font-style:italic;}
|
||
@page Section1
|
||
{size:8.5in 11.0in;
|
||
margin:1.0in 65.95pt 1.0in 65.95pt;}
|
||
div.Section1
|
||
{page:Section1;}
|
||
/* List Definitions */
|
||
ol
|
||
{margin-bottom:0in;}
|
||
ul
|
||
{margin-bottom:0in;}
|
||
-->
|
||
</style>
|
||
|
||
</head>
|
||
|
||
<body lang=EN-US>
|
||
|
||
<div class=Section1>
|
||
|
||
<p class=MsoPlainText style='margin-right:224.25pt'>Here is some sample code
|
||
for how to change cameras using the DG_CONTROL / DAT_FILESYSTEM operations.</p>
|
||
|
||
<p class=MsoPlainText style='margin-right:224.25pt'> </p>
|
||
|
||
<p class=MsoPlainText> </p>
|
||
|
||
<p class=MsoPlainText>TW_FILESYSTEM fs;</p>
|
||
|
||
<p class=MsoPlainText>TW_STR255 cameraname[3];</p>
|
||
|
||
<p class=MsoPlainText> </p>
|
||
|
||
<p class=MsoPlainText>// For loop used to discover available cameras...</p>
|
||
|
||
<p class=MsoPlainText>memset(cameraname,0,sizeof(cameraname));</p>
|
||
|
||
<p class=MsoPlainText>for (rc = (*pDSM_Entry)</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (&AppId,&SourceId,</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>DG_CONTROL,</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>DAT_FILESYSTEM,</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>MSG_GETFIRSTFILE,(TW_MEMREF)&fs);</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD> rc == TWRC_SUCCESS;</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD> rc = (*pDSM_Entry)</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (&AppId,&SourceId,</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>DG_CONTROL,</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>DAT_FILESYSTEM,</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>MSG_GETNEXTFILE,(TW_MEMREF)&fs)) {</p>
|
||
|
||
<p class=MsoPlainText> </p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // This is the combined front / rear camera...</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // In each case, just take the first one we find...</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> if (fs.FileType == TWFY_CAMERA) {</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> if (!cameraname[0][0])
|
||
strcpy(cameraname[0],fs.OutputName);</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // This is the front camera...</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> } else if (fs.FileType == TWFY_CAMERA_TOP) {</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> if (!cameraname[1][0])
|
||
strcpy(cameraname[1],fs.OutputName);</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // This is the rear camera...</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> } else if (fs.FileType == TWFY_CAMERA_BOTTOM) {</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> if (!cameraname[2][0])
|
||
strcpy(cameraname[2],fs.OutputName);</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> }</p>
|
||
|
||
<p class=MsoPlainText>}</p>
|
||
|
||
<p class=MsoPlainText> </p>
|
||
|
||
<p class=MsoPlainText>// Change to the front camera...</p>
|
||
|
||
<p class=MsoPlainText>strcpy(fs.InputName,cameraname[1]);</p>
|
||
|
||
<p class=MsoPlainText>rc = (*pDSM_Entry)</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (&AppId,&SourceId,</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>DG_CONTROL,</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>DAT_FILESYSTEM,</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>MSG_CHANGEDIRECTORY,(TW_MEMREF)&fs);</p>
|
||
|
||
<p class=MsoPlainText>// Set some front capabilities, like ICAP_CONTRAST</p>
|
||
|
||
<p class=MsoPlainText>...</p>
|
||
|
||
<p class=MsoPlainText> </p>
|
||
|
||
<p class=MsoPlainText>// Change to the rear camera...</p>
|
||
|
||
<p class=MsoPlainText>strcpy(fs.InputName,cameraname[2]);</p>
|
||
|
||
<p class=MsoPlainText>rc = (*pDSM_Entry)</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (&AppId,&SourceId,</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>DG_CONTROL,</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>DAT_FILESYSTEM,</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>MSG_CHANGEDIRECTORY,(TW_MEMREF)&fs);</p>
|
||
|
||
<p class=MsoPlainText>// Set some rear capabilities, like ICAP_CONTRAST</p>
|
||
|
||
<p class=MsoPlainText>...</p>
|
||
|
||
<p class=MsoPlainText> </p>
|
||
|
||
<p class=MsoPlainText>// Change back to the combined camera (have to do</p>
|
||
|
||
<p class=MsoPlainText>// this before scanning starts, but can also do</p>
|
||
|
||
<p class=MsoPlainText>// this to simultaneously change front and rear</p>
|
||
|
||
<p class=MsoPlainText>// values).<2E> Note that this is the default camera</p>
|
||
|
||
<p class=MsoPlainText>// when the Source is first started...</p>
|
||
|
||
<p class=MsoPlainText>strcpy(fs.InputName,cameraname[0]);</p>
|
||
|
||
<p class=MsoPlainText>rc = (*pDSM_Entry)</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (&AppId,&SourceId,</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>DG_CONTROL,</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>DAT_FILESYSTEM,</p>
|
||
|
||
<p class=MsoPlainText><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>MSG_CHANGEDIRECTORY,(TW_MEMREF)&fs);</p>
|
||
|
||
<p class=MsoPlainText>...</p>
|
||
|
||
</div>
|
||
|
||
</body>
|
||
|
||
</html>
|