⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 routines.pas

📁 扫描软件
💻 PAS
📖 第 1 页 / 共 3 页
字号:
unit Routines;
interface
uses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  Dialogs, StdCtrls;
type










gstrappdirectory : string;//----------------------------------------------------------
gstrwindowsdirectory : string;
gstrwindowstempdirectory : string;




gstrfilename : string;//----------------------------------------------------------
gstrpathname : string;
gstrfullpathfilename : string;




gintscantings : integer;//----------------------------------------------------------
gintdocumenttypeindex : integer;
gblnuseadf : boolean;
gstrscantodirectory : string;




gintcolorindex : integer;//----------------------------------------------------------
ginthorizontaldpi : integer;
gintverticaldpi : integer;
gintpapersizeindex : integer;
gdblpaperwidth : double;
gdblpaperheight : double;




gblngetimagetypesavailablesupported : boolean;//----------------------------------------------------------

gblngetmaxheightsupported : boolean;
gblngetmaxwidthsupported : boolean;

gblngetminresolutionsupported : boolean;
gblngetmaxresolutionsupported : boolean;
gblngetresolutionstepsupported : boolean;

gblngetminbrightnesssupported : boolean;
gblngetmaxbrightnesssupported : boolean;
gblngetbrightnessstepsupported : boolean;
gblngetautobrightnesssupported : boolean;

gblngetmincontrastsupported : boolean;
gblngetmaxcontrastsupported : boolean;
gblngetcontraststepsupported : boolean;
gblngetautocontrastsupported : boolean;

gblngetadfavailablesupported : boolean;
gblngetmaxheightadfsupported : boolean;




gblnimagetypesupported : boolean;//----------------------------------------------------------

gblnresolutionxsupported : boolean;
gblnresolutionysupported : boolean;

gblnbrightnessmodesupported : boolean;
gblnbrightnesssupported : boolean;

gblncontrastmodesupported : boolean;
gblncontrastsupported : boolean;

gblnimagelayoutsupported : boolean;
gblnscanmodesupported : boolean;




gblngetcapabilityrangedone : boolean;//----------------------------------------------------------

gintimagetypesavailable : integer;
gblnimagetypesavailable(7) : boolean;
gstrimagetypestrings(7) : string;

gsngmaxheight : single;
gsngmaxwidth : single;

glngminresolution : longint;
glngmaxresolution : longint;
gblnresolutionsteparray : boolean;
glngresolutionstep : longint;
gvntresolutionstep : variant;

glngminbrightness : longint;
glngmaxbrightness : longint;
gblnbrightnesssteparray : boolean;
glngbrightnessstep : longint;
gvntbrightnessstep : variant;
gstrautobrightness : string;

glngmincontrast : longint;
glngmaxcontrast : longint;
gblncontraststeparray : boolean;
glngcontraststep : longint;
gvntcontraststep : variant;
gstrautocontrast : string;

gstradfavailable : string;
gsngmaxheightadf : single;




gintimagetype : integer;//----------------------------------------------------------
glngresolutionx : longint;
glngresolutiony : longint;
gintbrightnessmode : integer;
glngbrightness : longint;
gintcontrastmode : longint;
glngcontrast : longint;
gsngleft : single;
gsngtop : single;
gsngwidth : single;
gsngheight : single;
gintscanmode : integer;




gblntrackimgscanevent(8) : boolean;//----------------------------------------------------------








// left unchanged ==> public enum color;//----------------------------------------------------------
clblackandwhite := 0;
cl16shadesofgray := 1;
cl256shadesofgray := 2;
cl256colors := 3;
cltruecolor := 4;
end;




// left unchanged ==> public enum documenttype;//----------------------------------------------------------
dttextonly := 0;
dtarticle := 1;
dtcolorarticle := 2;
dtphotograph := 3;
dtbusinesscard := 4;
dtlinedrawing := 5;
dtpoorquality := 6;
dtlegaldocument := 7;
dtcustom := 8;
end;




// left unchanged ==> public enum papersize;//----------------------------------------------------------
psletter := 0;
psbusinesscard := 1;
psphoto := 2;
pslargephoto := 3;
pstabloid := 4;
psledger := 5;
pslegal := 6;
psstatement := 7;
psexecutive := 8;
psa3 := 9;
psa4 := 10;
psa5 := 11;
psb4iso := 12;
psb4jis := 13;
psb5iso := 14;
psb5jis := 15;
psfolio := 16;
psquarto := 17;
ps10x14 := 18;
pscustom := 19;
end;




// left unchanged ==> public enum imgscanevent;//----------------------------------------------------------
isefilenamerequest := 0;
isepagedone := 1;
isescandone := 2;
isescanstarted := 3;
isescanuidone := 4;
iseerror := 5;
isegetscancapability := 6;
isescancapability := 7;
end;

// left unchanged ==> public const cap_scan_image_types_supported = 1;
// left unchanged ==> public const cap_scan_max_height = 2;
// left unchanged ==> public const cap_scan_max_height_adf = 3;
// left unchanged ==> public const cap_scan_max_width = 4;
// left unchanged ==> public const cap_scan_min_resolution = 5;
// left unchanged ==> public const cap_scan_max_resolution = 6;
// left unchanged ==> public const cap_scan_step_resolution = 7;
// left unchanged ==> public const cap_scan_min_brightness = 8;
// left unchanged ==> public const cap_scan_max_brightness = 9;
// left unchanged ==> public const cap_scan_step_brightness = 10;
// left unchanged ==> public const cap_scan_auto_brightness = 11;
// left unchanged ==> public const cap_scan_min_contrast = 12;
// left unchanged ==> public const cap_scan_max_contrast = 13;
// left unchanged ==> public const cap_scan_step_contrast = 14;
// left unchanged ==> public const cap_scan_auto_contrast = 15;
// left unchanged ==> public const cap_scan_adf_supported = 16;
// left unchanged ==> public const cap_scan_readonly_caps = 16;

// left unchanged ==> public const cap_scan_image_type = 100;// save some for future expansion
// left unchanged ==> public const cap_scan_resolution = 101;
// left unchanged ==> public const cap_scan_brightness_mode = 102;
// left unchanged ==> public const cap_scan_brightness = 103;
// left unchanged ==> public const cap_scan_contrast_mode = 104;
// left unchanged ==> public const cap_scan_contrast = 105;
// left unchanged ==> public const cap_scan_image_layout = 106;
// left unchanged ==> public const cap_scan_mode = 107;
// left unchanged ==> public const cap_scan_paper_in_feeder = 108;




// left unchanged ==> public const cant_access_dir = 'cannot access directory ';//----------------------------------------------------------
// left unchanged ==> public const brightness_between_1 = 'brightness must be between ';
// left unchanged ==> public const brightness_between_2 = '.';
// left unchanged ==> public const brightness_numeric = 'brightness must be numeric.';
// left unchanged ==> public const contrast_numeric = 'contrast must be numeric.';
// left unchanged ==> public const contrast_between_1 = 'contrast must be between ';
// left unchanged ==> public const contrast_between_2 = '.';
// left unchanged ==> public const delete_files_and_restart = 'are you sure you want to delete the files and restart?';
// left unchanged ==> public const get_capabilities_first = 'you must get the current scanner capabilities before you  them.';
// left unchanged ==> public const height_numeric = 'height must be numeric.';
// left unchanged ==> public const left_numeric = 'left must be numeric.';
// left unchanged ==> public const resolution_between_1 = 'resolution must be between ';
// left unchanged ==> public const resolution_between_2 = ' dpi.';
// left unchanged ==> public const resolution_numeric = 'resolution must be numeric.';
// left unchanged ==> public const top_numeric = 'top must be numeric.';
// left unchanged ==> public const width_numeric = 'width must be numeric.';
// left unchanged ==> public const workfile_pages_unequal = 'the page counts of the 2 workfiles are not equal.';




// left unchanged ==> public const app_name = 'imgscan';//----------------------------------------------------------
// left unchanged ==> public const scan_pref_key = 'scan preferences';
// left unchanged ==> public const window_pos_key = 'window position';




// left unchanged ==> public const cancel_pressed = 32755;//----------------------------------------------------------





mstrpmetype : string;//**************************************************************
mstreventname : string;
mstrparameters : string;





// left unchanged ==> private const property_legend = 'property:  ';//**************************************************************
// left unchanged ==> private const method_legend = 'method:    ';
// left unchanged ==> private const event_legend = 'event:     ';

function convertbytes(lngbytes : longint;strxb : string):long;
begin









if  strxb = 'kb'  then
begin
convertbytes := lngbytes \ 2 ^ 10    ;//1024
elseif strxb = 'mb' then
convertbytes := lngbytes \ 2 ^ 20    ;//1048576
elseif strxb = 'gb' then
convertbytes := lngbytes \ 2 ^ 30;
else 
convertbytes := lngbytes;
end; //Main if block

end;

procedure deletefile(strworkfile : string);
begin




strfilename : string;




if  strworkfile = ''  then
begin
// left unchanged ==> exit;//----------------------------------------------------------
end; //Main if block




strfilename := dir(strworkfile);//----------------------------------------------------------
if  strfilename <> ''  then
begin
// left unchanged ==> doevents;
kill strworkfile
end; //Main if block

end;

function getimagetypelegend(intimagetype : integer):string;
begin






intcounter : integer;

strworkinglegend : string;

if  intimagetype = 0  then
begin
getimagetypelegend := 'unknown';//** strings
// left unchanged ==> exit;
end; //Main if block

if  intimagetype and 1  then
begin
strworkinglegend := 'black and white';
intcounter := intcounter + 1;
end; //Main if block

if  intimagetype and 2  then
begin
if  intcounter > 0  then
begin
strworkinglegend := strworkinglegend + '; 16 shades of gray';
else 
strworkinglegend := '16 shades of gray';
end; //Main if block
intcounter := intcounter + 1;
end; //Main if block

if  intimagetype and 4  then
begin
if  intcounter > 0  then
begin
strworkinglegend := strworkinglegend + '; 256 shades of gray';
else 
strworkinglegend := '256 shades of gray';
end; //Main if block
intcounter := intcounter + 1;
end; //Main if block

if  intimagetype and 8  then
begin

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -