home *** CD-ROM | disk | FTP | other *** search
/ Computerworld 1996 March / Computerworld_1996-03_cd.bin / idg_cd3 / aplikace / office / ccopier1 / source / eztwain.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-02-14  |  21.2 KB  |  549 lines

  1. unit Eztwain;
  2. {
  3.  This unit is based on the eztwain.h for interfacing of the
  4.  eztwain.dll by spike. I included the original comments from
  5.  the source.
  6.  
  7.  The source of eztwain is available from:
  8.      <ftp://ftp.caere.com/pub/twain>
  9.  
  10.  This unit is sample code as like as the original eztwain.h.
  11.  Matthias Weingart '95.
  12. }
  13. {
  14. // EZTWAIN.H - interface to Easy TWAIN library
  15. //
  16. // EZTWAIN is not a product, and is not the work of any company involved
  17. // in promoting or using the TWAIN standard.  This code is sample code,
  18. // provided without charge, and you use it entirely at your own risk.
  19. // No rights or ownership is claimed by the author, or by any company
  20. // or organization.
  21. //
  22. // 0.0    05/11/94    created
  23. // 1.0a    06/23/94    first alpha version
  24. // 1.04 05/03/95    added: WriteNativeToFile, WriteNativeToFilename,
  25. //                    FreeNative, SetHideUI, GetHideUI, SetCurrentUnits,
  26. //                    GetCurrentUnits, SetCurrentResolution, SetBitDepth,
  27. //                    SetCurrentPixelType, SetCapOneValue.
  28.         11/12/95    interface for delphi by Matthias Weingart
  29. }
  30.  
  31. interface
  32.  
  33. uses wintypes;
  34.  
  35. function TWAIN_AcquireNative(hwndApp: HWND; wPixTypes: word): HBitmap;
  36.   far;
  37. {
  38. // The minimal use of EZTWAIN.DLL is to just call this routine, with 0 for
  39. // both params.  EZTWAIN creates a window if hwndApp is 0.
  40. //
  41. // Acquires a single image, from the currently selected Data Source, using
  42. // Native-mode transfer. It waits until the source closes (if it's modal) or
  43. // forces the source closed if not.  The return value is a handle to the
  44. // acquired image.  Only one image can be acquired per call.
  45. //
  46. // Under Windows, the return value is a global memory handle - applying
  47. // GlobalLock to it will return a (huge) pointer to the DIB, which
  48. // starts with a BITMAPINFOHEADER.
  49. // NOTE: You are responsible for disposing of the returned DIB - these things
  50. // can eat up your Windows memory fast!  See TWAIN_FreeNative below.
  51. //
  52. // The image type can be restricted using the following masks.  A mask of 0
  53. // means 'any pixel type is welcome'.
  54. // Caution: You should not assume that the source will honor a pixel type
  55. // restriction!  If you care, check the parameters of the DIB.
  56. }
  57. const
  58.      TWAIN_BW=1;      { 1-bit per pixel, B&W      (== TWPT_BW) }
  59.      TWAIN_GRAY=2;      { 1,4, or 8-bit grayscale  (== TWPT_GRAY) }
  60.      TWAIN_RGB=4;      { 24-bit RGB color         (== TWPT_RGB) }
  61.      TWAIN_PALETTE=8; { 1,4, or 8-bit palette    (== TWPT_PALETTE) }
  62.      TWAIN_ANYTYPE=0; { any of the above }
  63.  
  64. procedure TWAIN_FreeNative(hdib: HBitmap);
  65.  far;
  66. {
  67. // Release the memory allocated to a native format image, as returned by
  68. // TWAIN_AcquireNative. (If you are coding in C or C++, this is just a call
  69. // to GlobalFree.)
  70. // If you use TWAIN_AcquireNative and don't free the returned image handle,
  71. // it stays around taking up Windows (virtual) memory until your application
  72. // terminates.  Memory required per square inch:
  73. //             1 bit B&W       8-bit grayscale     24-bit color
  74. // 100 dpi      1.25KB              10KB               30KB
  75. // 200 dpi        5KB               40KB              120KB
  76. // 300 dpi      11.25KB             90KB              270KB
  77. // 400 dpi       20KB              160KB              480KB
  78. //
  79. }
  80. function TWAIN_AcquireToClipboard(hwndApp: HWND; wPixTypes: word): integer;
  81.  far;
  82. {
  83. // Like AcquireNative, but puts the resulting image, if any, into the system
  84. // clipboard.  Under Windows, this will put a CF_DIB item in the clipboard
  85. // if successful.  If this call fails, the clipboard is either empty or
  86. // contains the old contents.
  87. // A return value of 1 indicates success, 0 indicates failure.
  88. //
  89. // Useful for environments like Visual Basic where it is hard to make direct
  90. // use of a DIB handle.  In fact, TWAIN_AcquireToClipboard uses
  91. // TWAIN_AcquireNative for all the hard work.
  92. }
  93. function TWAIN_SelectImageSource(hwnd: HWND): integer;
  94.  far;
  95. {
  96. // This is the routine to call when the user chooses the "Select Source..."
  97. // menu command from your application's File menu.  Your app has one of
  98. // these, right?  The TWAIN spec calls for this feature to be available in
  99. // your user interface, preferably as described.
  100. // Note: If only one TWAIN device is installed on a system, it is selected
  101. // automatically, so there is no need for the user to do Select Source.
  102. // You should not require your users to do Select Source before Acquire.
  103. //
  104. // This function posts the Source Manager's Select Source dialog box.
  105. // It returns after the user either OK's or CANCEL's that dialog.
  106. // A return of 1 indicates OK, 0 indicates one of the following:
  107. //   a) The user cancelled the dialog
  108. //   b) The Source Manager found no data sources installed
  109. //   c) There was a failure before the Select Source dialog could be posted
  110. // -- details --
  111. // Only sources that can return images (that are in the DG_IMAGE group) are
  112. // displayed.  The current default source will be highlighted initially.
  113. // In the standard implementation of "Select Source...", your application
  114. // doesn't need to do anything except make this one call.
  115. //
  116. // If you want to be meticulous, disable your "Acquire" and "Select Source"
  117. // menu items or buttons if TWAIN_IsAvailable() returns 0 - see below.
  118. }
  119.  
  120. {--------- Basic TWAIN Inquiries  }
  121.  
  122. function TWAIN_IsAvailable: integer;
  123.  far;
  124. {
  125. // Call this function any time to find out if TWAIN is installed on the
  126. // system.  It takes a little time on the first call, after that it's fast,
  127. // just testing a flag.  It returns 1 if the TWAIN Source Manager is
  128. // installed & can be loaded, 0 otherwise.
  129. }
  130. function TWAIN_EasyVersion: integer;
  131.  far;
  132. {
  133. // Returns the version number of EZTWAIN.DLL, multiplied by 100.
  134. // So e.g. version 2.01 will return 201 from this call.
  135. }
  136. function TWAIN_State: integer;
  137.  far;
  138. {
  139. // Returns the TWAIN Protocol State per the spec.
  140. }
  141. const
  142.    TWAIN_PRESESSION=1;        {    source manager not loaded }
  143.    TWAIN_SM_LOADED=2;          { source manager loaded }
  144.    TWAIN_SM_OPEN=3;           { source manager open }
  145.    TWAIN_SOURCE_OPEN=4;       { source open but not enabled }
  146.    TWAIN_SOURCE_ENABLED=5;    { source enabled to acquire }
  147.    TWAIN_TRANSFER_READY=6;    { image ready to transfer }
  148.    TWAIN_TRANSFERRING=7;      { image in transit }
  149.  
  150. {--------- BMP file utilities  }
  151.  
  152. function TWAIN_WriteNativeToFilename(hdib: HBitmap; pszFile: Pchar ): integer;
  153.  far;
  154. {
  155. // Writes a DIB handle to a .BMP file
  156. //
  157. // hdib        = DIB handle, as returned by TWAIN_AcquireNative
  158. // pszFile    = far pointer to NUL-terminated filename
  159. // If pszFile is NULL or points to a null string, prompts the user
  160. // for the filename with a standard file-save dialog.
  161. //
  162. // Return values:
  163. //     0    success
  164. //    -1    user cancelled File Save dialog
  165. //    -2    file open error (invalid path or name, or access denied)
  166. //    -3    (weird) unable to lock DIB - probably an invalid handle.
  167. //    -4    writing BMP data failed, possibly output device is full
  168. }
  169. function TWAIN_WriteNativeToFile(hdib: HBitmap; fh: integer): integer;
  170.  far;
  171. {
  172. // Writes a DIB to a file in .BMP format.
  173. //
  174. // hdib        = DIB handle, as returned by TWAIN_AcquireNative
  175. // fh        = file handle, as returned by _open, _lopen or OpenFile
  176. //
  177. // Return value as for TWAIN_WriteNativeToFilename
  178. }
  179.  
  180. { --------- Application Registration  }
  181.  
  182. procedure TWAIN_RegisterApp(            { record application information }
  183.     nMajorNum,nMinorNum: integer;       { major and incremental revision of application. E.g. }
  184.                                         { for version 2.1, nMajorNum == 2 and nMinorNum == 1 }
  185.     nLanguage: integer;                    { language of this version (use TWLG_xxx from TWAIN.H) }
  186.     nCountry: integer;                    { country of this version (use TWCY_xxx from TWAIN.H) }
  187.     lpszVersion: PChar;                    { version info string e.g. "1.0b3 Beta release" }
  188.     lpszMfg: PChar;                        { name of manufacturer/developer e.g. "Crazbat Software" }
  189.     lpszFamily: PChar;                    { product family e.g. "BitStomper" }
  190.     lpszProduct: PChar);                { specific product e.g. "BitStomper Deluxe Pro" }
  191.  far;
  192. {
  193. // TWAIN_RegisterApp can be called *AS THE FIRST CALL*, to register the
  194. // application. If this function is not called, the application is given a
  195. // 'generic' registration by EZTWAIN.
  196. // Registration only provides this information to the Source Manager and any
  197. // sources you may open - it is used for debugging, and (frankly) by some
  198. // sources to give special treatment to certain applications.
  199. }
  200.  
  201. { --------- Lower-level functions for greater control of the TWAIN protocol --------}
  202.  
  203. procedure TWAIN_SetHideUI(fHide: integer);
  204.  far;
  205. function TWAIN_GetHideUI: integer;
  206.  far;
  207. {
  208. // These functions control the 'hide source user interface' flag.
  209. // This flag is cleared initially, but if you set it non-zero, then when
  210. // a source is enabled it will be asked to hide its user interface.
  211. // Note that this is only a request - some sources will ignore it!
  212. // This affects AcquireNative, AcquireToClipboard, and EnableSource.
  213. // If the user interface is hidden, you will probably want to set at least
  214. // some of the basic acquisition parameters yourself - see
  215. // SetCurrentUnits, SetBitDepth, SetCurrentPixelType and
  216. // SetCurrentResolution below.
  217. }
  218. function TWAIN_GetResultCode: word;
  219.  far;
  220. {
  221. // Return the result code (TWRC_xxx) from the last triplet sent to TWAIN
  222. }
  223. function TWAIN_GetConditionCode: word;
  224.  far;
  225. {
  226. // Return the condition code from the last triplet sent to TWAIN.
  227. // (To be precise, from the last call to TWAIN_DS below)
  228. // If a source is NOT open, return the condition code of the source manager.
  229. }
  230. function TWAIN_LoadSourceManager: integer;
  231.  far;
  232. {
  233. // Finds and loads the Data Source Manager, TWAIN.DLL.
  234. // If Source Manager is already loaded, does nothing and returns TRUE.
  235. // This can fail if TWAIN.DLL is not installed (in the right place), or
  236. // if the library cannot load for some reason (insufficient memory?) or
  237. // if TWAIN.DLL has been corrupted.
  238. }
  239. function TWAIN_OpenSourceManager(hwnd: HWND): integer;
  240.  far;
  241. {
  242. // Opens the Data Source Manager, if not already open.
  243. // If the Source Manager is already open, does nothing and returns TRUE.
  244. // This call will fail if the Source Manager is not loaded.
  245. }
  246. function TWAIN_OpenDefaultSource: integer;
  247.  far;
  248. {
  249. // This opens the source selected in the Select Source dialog.
  250. // If a source is already open, does nothing and returns TRUE.
  251. // Fails if the source manager is not loaded and open.
  252. }
  253. function TWAIN_EnableSource(hwnd: HWND): integer;
  254.  far;
  255. {
  256. // Enables the open Data Source. This posts the source's user interface
  257. // and allows image acquisition to begin.  If the source is already enabled,
  258. // this call does nothing and returns TRUE.
  259. }
  260. function TWAIN_DisableSource: integer;
  261.  far;
  262. {
  263. // Disables the open Data Source, if any.
  264. // This closes the source's user interface.
  265. // If there is not an enabled source, does nothing and returns TRUE.
  266. }
  267. function TWAIN_CloseSource: integer;
  268.  far;
  269. {
  270. // Closes the open Data Source, if any.
  271. // If the source is enabled, disables it first.
  272. // If there is not an open source, does nothing and returns TRUE.
  273. }
  274. function TWAIN_CloseSourceManager(hwnd: HWND): integer;
  275.  far;
  276. {
  277. // Closes the Data Source Manager, if it is open.
  278. // If a source is open, disables and closes it as needed.
  279. // If the Source Manager is not open, does nothing and returns TRUE.
  280. }
  281. function TWAIN_UnloadSourceManager: integer;
  282.  far;
  283. {
  284. // Unloads the Data Source Manager i.e. TWAIN.DLL - releasing
  285. // any associated memory or resources.
  286. // This call will fail if the Source Manager is open, otherwise
  287. // it always succeeds and returns TRUE.
  288. }
  289. function TWAIN_MessageHook(lpmsg: PMsg): integer;
  290.  far;
  291. (*
  292. // This function detects Windows messages that should be routed
  293. // to an enabled Data Source, and picks them off.  In a full TWAIN
  294. // app, TWAIN_MessageHook is called inside the main GetMessage loop.
  295. // The skeleton code looks like this:
  296. //        MSG msg;
  297. //      while (GetMessage((LPMSG)&msg, NULL, 0, 0)) {
  298. //            if (!TWAIN_MessageHook ((LPMSG)&msg)) {
  299. //                TranslateMessage ((LPMSG)&msg);
  300. //                DispatchMessage ((LPMSG)&msg);
  301. //            }
  302. //        } // while
  303. *)
  304. procedure TWAIN_ModalEventLoop;
  305.  far;
  306. {
  307. // Process messages until termination, source disable, or image transfer.
  308. //
  309. // Executes exactly the sample code given above for TWAIN_MessageHook, but
  310. // terminates as soon as the source is disabled or a transfer completes.
  311. // This function is called by TWAIN_AcquireNative.
  312. }
  313. function TWAIN_AbortAllPendingXfers: integer;
  314.  far;
  315.  
  316. function TWAIN_WriteDibToFile(lpDIB: PBITMAPINFOHEADER; fh: integer): integer;
  317.  far;
  318. {
  319. // Writes a DIB to a file in .BMP format.
  320. // Returns TRUE if successful, FALSE otherwise.
  321. // (Likely causes of failure: device full, or permission denied to write to file or device
  322. // lpDIB    = pointer to DIB, as from GlobalLock of DIB handle
  323. // fh        = file handle, as returned by C _open or Windows _lopen or OpenFile
  324. // For example of use, see TWAIN_WriteNativeToFilename in EZTWAIN.C
  325. }
  326. function TWAIN_NegotiateXferCount(nXfers: integer): integer;
  327.  far;
  328. {
  329. // Negotiate with open Source the number of images application will accept.
  330. // This is only allowed in State 4 (TWAIN_SOURCE_OPEN)
  331. // nXfers = -1 means any number
  332. }
  333. function TWAIN_NegotiatePixelTypes(wPixTypes: word): integer;
  334.  far;
  335. {
  336. // Negotiate with the source to restrict pixel types that can be acquired.
  337. // This tries to restrict the source to a *set* of pixel types,
  338. // See TWAIN_AcquireNative above for some mask constants.
  339. // --> This is only allowed in State 4 (TWAIN_SOURCE_OPEN)
  340. // A parameter of 0 (TWAIN_ANYTYPE) causes no negotiation & no restriction.
  341. // You should not assume that the source will honor your restrictions, even
  342. // if this call succeeds!
  343. }
  344. function TWAIN_GetCurrentUnits: integer;
  345.  far;
  346. {
  347. // Ask the source what its current unit of measure is.
  348. // If anything goes wrong, this function just returns TWUN_INCHES (0).
  349. }
  350. function TWAIN_SetCurrentUnits(nUnits: integer): integer;
  351.  far;
  352. {
  353. // Set the current unit of measure for the source.
  354. // Unit of measure codes are in TWAIN.H, but TWUN_INCHES is 0.
  355. }
  356. const
  357.      TWUN_INCHES=0;
  358.      TWUN_CENTIMETERS=1;
  359.      TWUN_PICAS=2;
  360.      TWUN_POINTS=3;
  361.      TWUN_TWIPS=4;
  362.      TWUN_PIXELS=5;
  363.  
  364. function TWAIN_GetBitDepth: integer;
  365.  far;
  366. {
  367. // Get the current bitdepth, which can depend on the current PixelType.
  368. // Bit depth is per color channel e.g. 24-bit RGB has bit depth 8.
  369. // If anything goes wrong, this function returns 0.
  370. }
  371. function TWAIN_SetBitDepth(nBits: integer): integer;
  372.  far;
  373. {
  374. // (Try to) set the current bitdepth (for the current pixel type).
  375. }
  376. function TWAIN_GetPixelType: integer;
  377.  far;
  378. {
  379. // Ask the source for the current pixel type.
  380. // If anything goes wrong (it shouldn't), this function returns 0 (TWPT_BW).
  381. }
  382. function TWAIN_SetCurrentPixelType(nPixType: integer): integer;
  383.  far;
  384. {
  385. // (Try to) set the current pixel type for acquisition.
  386. // This is only allowed in State 4 (TWAIN_SOURCE_OPEN)
  387. // The source may select this pixel type, but don't assume it will.
  388. }
  389. function TWAIN_GetCurrentResolution: double;
  390.  far;
  391. {
  392. // Ask the source for the current resolution.
  393. // Resolution is in dots per current unit! (See TWAIN_GetCurrentUnits above)
  394. // If anything goes wrong (it shouldn't) this function returns 0.0
  395. }
  396. function TWAIN_SetCurrentResolution(dRes: double): integer;
  397.  far;
  398. {
  399. // (Try to) set the current resolution for acquisition.
  400. // Resolution is in dots per current unit! (See TWAIN_GetCurrentUnits above)
  401. // This is only allowed in State 4 (TWAIN_SOURCE_OPEN)
  402. // Note: The source may select this resolution, but don't assume it will.
  403. }
  404.  
  405. { --------- Low-level capability negotiation functions --------
  406.  
  407. // Setting a capability is valid only in State 4 (TWAIN_SOURCE_OPEN)
  408. // Getting a capability is valid in State 4 or any higher state.
  409. }
  410. function TWAIN_SetCapOneValue( Cap:      word;
  411.                                ItemType: word;
  412.                                ItemVal:  longint): integer;
  413.  far;
  414. {
  415. // Do a DAT_CAPABILITY/MSG_SET, on capability 'Cap' (e.g. ICAP_PIXELTYPE,
  416. // CAP_AUTOFEED, etc.) using a TW_ONEVALUE container with the given item type
  417. // and value.  Obviously, the item value must fit into 32 bits.
  418. // Returns TRUE (1) if successful, FALSE (0) otherwise.
  419. }
  420. function TWAIN_GetCapCurrent( Cap:      word;
  421.                               ItemType: word;
  422.                               pVal: pointer): integer;  {far pointer!}
  423.  far;
  424. {
  425. // Do a DAT_CAPABILITY/MSG_GETCURRENT on capability 'Cap'.
  426. // Copy the current value out of the returned container into *pVal.
  427. // If the operation fails (the source refuses the request), or if the
  428. // container is not a ONEVALUE or ENUMERATION, or if the item type of the
  429. // returned container is incompatible with the expected TWTY_ type in nType,
  430. // returns FALSE.  If this function returns FALSE, *pVal is not touched.
  431. }
  432.  
  433. { --------- Lowest-level functions for TWAIN protocol -------- }
  434.  
  435. function TWAIN_DS(DG: longint; DAT: word; MSG: word; pData: Pointer): integer;
  436.  far;
  437. {
  438. // Passes the triplet (DG, DAT, MSG, pData) to the open data source if any.
  439. // Returns 1 (TRUE) if the result code is TWRC_SUCCESS, 0 (FALSE) otherwise.
  440. // The last result code can be retrieved with TWAIN_GetResultCode(), and the corresponding
  441. // condition code can be retrieved with TWAIN_GetConditionCode().
  442. // If no source is open this call will fail, result code TWRC_FAILURE, condition code TWCC_NODS.
  443. }
  444. function TWAIN_Mgr(DG: longint; DAT: word; MSG: word; pData: Pointer): integer;
  445.  far;
  446. {
  447. // Passes a triplet to the Data Source Manager (DSM).
  448. // Returns 1 (TRUE) if the result code is TWRC_SUCCESS, 0 (FALSE) otherwise.
  449. // The last result code can be retrieved with TWAIN_GetResultCode(), and the corresponding
  450. // condition code can be retrieved with TWAIN_GetConditionCode().
  451. // If the Source Manager is not open, this call will fail, and set the result code to TWRC_FAILURE,
  452. // with a condition code of TWCC_SEQERROR (triplet out of sequence).
  453. }
  454.  
  455. implementation
  456.  
  457. function TWAIN_AcquireNative(hwndApp: HWND; wPixTypes: word): HBitmap;
  458.   external 'EZTWAIN';
  459. procedure TWAIN_FreeNative(hdib: HBitmap);
  460.   external 'EZTWAIN';
  461. function TWAIN_AcquireToClipboard(hwndApp: HWND; wPixTypes: word): integer;
  462.   external 'EZTWAIN';
  463. function TWAIN_SelectImageSource(hwnd: HWND): integer;
  464.   external 'EZTWAIN';
  465. function TWAIN_IsAvailable: integer;
  466.   external 'EZTWAIN';
  467. function TWAIN_EasyVersion: integer;
  468.   external 'EZTWAIN';
  469. function TWAIN_State: integer;
  470.   external 'EZTWAIN';
  471. function TWAIN_WriteNativeToFilename(hdib: HBitmap; pszFile: PChar ): integer;
  472.   external 'EZTWAIN';
  473. function TWAIN_WriteNativeToFile(hdib: HBitmap; fh: integer): integer;
  474.   external 'EZTWAIN';
  475. procedure TWAIN_RegisterApp( nMajorNum,nMinorNum: integer;
  476.                              nLanguage: integer;
  477.                              nCountry: integer;
  478.                              lpszVersion: PChar;
  479.                              lpszMfg: PChar;
  480.                              lpszFamily: PChar;
  481.                              lpszProduct: PChar);
  482.   external 'EZTWAIN';
  483. procedure TWAIN_SetHideUI(fHide: integer);
  484.   external 'EZTWAIN';
  485. function TWAIN_GetHideUI: integer;
  486.   external 'EZTWAIN';
  487. function TWAIN_GetResultCode: word;
  488.   external 'EZTWAIN';
  489. function TWAIN_GetConditionCode: word;
  490.   external 'EZTWAIN';
  491. function TWAIN_LoadSourceManager: integer;
  492.   external 'EZTWAIN';
  493. function TWAIN_OpenSourceManager(hwnd: HWND): integer;
  494.   external 'EZTWAIN';
  495. function TWAIN_OpenDefaultSource: integer;
  496.   external 'EZTWAIN';
  497. function TWAIN_EnableSource(hwnd: HWND): integer;
  498.   external 'EZTWAIN';
  499. function TWAIN_DisableSource: integer;
  500.   external 'EZTWAIN';
  501. function TWAIN_CloseSource: integer;
  502.   external 'EZTWAIN';
  503. function TWAIN_CloseSourceManager(hwnd: HWND): integer;
  504.   external 'EZTWAIN';
  505. function TWAIN_UnloadSourceManager: integer;
  506.   external 'EZTWAIN';
  507. function TWAIN_MessageHook(lpmsg: PMsg): integer;
  508.   external 'EZTWAIN';
  509. procedure TWAIN_ModalEventLoop;
  510.   external 'EZTWAIN';
  511. function TWAIN_AbortAllPendingXfers: integer;
  512.   external 'EZTWAIN';
  513. function TWAIN_WriteDibToFile(lpDIB: PBITMAPINFOHEADER; fh: integer): integer;
  514.   external 'EZTWAIN';
  515. function TWAIN_NegotiateXferCount(nXfers: integer): integer;
  516.   external 'EZTWAIN';
  517. function TWAIN_NegotiatePixelTypes(wPixTypes: word): integer;
  518.   external 'EZTWAIN';
  519. function TWAIN_GetCurrentUnits: integer;
  520.   external 'EZTWAIN';
  521. function TWAIN_SetCurrentUnits(nUnits: integer): integer;
  522.   external 'EZTWAIN';
  523. function TWAIN_GetBitDepth: integer;
  524.   external 'EZTWAIN';
  525. function TWAIN_SetBitDepth(nBits: integer): integer;
  526.   external 'EZTWAIN';
  527. function TWAIN_GetPixelType: integer;
  528.   external 'EZTWAIN';
  529. function TWAIN_SetCurrentPixelType(nPixType: integer): integer;
  530.   external 'EZTWAIN';
  531. function TWAIN_GetCurrentResolution: double;
  532.   external 'EZTWAIN';
  533. function TWAIN_SetCurrentResolution(dRes: double): integer;
  534.   external 'EZTWAIN';
  535. function TWAIN_SetCapOneValue( Cap: word;
  536.                                ItemType: word;
  537.                                ItemVal: longint): integer;
  538.   external 'EZTWAIN';
  539. function TWAIN_GetCapCurrent( Cap:      word;
  540.                               ItemType: word;
  541.                               pVal: pointer): integer;
  542.   external 'EZTWAIN';
  543. function TWAIN_DS(DG: longint; DAT: word; MSG: word; pData: Pointer): integer;
  544.   external 'EZTWAIN';
  545. function TWAIN_Mgr(DG: longint; DAT: word; MSG: word; pData: Pointer): integer;
  546.   external 'EZTWAIN';
  547.  
  548. end.
  549.