curtis
14小時前 0756bf12d10cf1b7f78c571de0a9ad69cbaeb7ca
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
{ ==============================================================================
  方法名稱:GetCurrentVersionNo
  引用相依:
  方法描述:獲取當前模組的版本號。透過 GetModuleFileName 獲取檔案路徑,再利用 GetF
            ileVersionInfoSize 和 GetFileVersionInfo 讀取版本資訊。接著從 VarFile
            Info\Translation 取得語系資訊,最後從 StringFileInfo 中提取 FileVersi
            on 並回傳為字串。
============================================================================== }
function TCB_IMGPSScanX.GetCurrentVersionNo: String; //獲取自身版本號所需要
var
  dLength,dSize:DWORD;
  pcBuf,pcValue:PChar;
  TempVersionLanguage:TVersionLanguage;
  sTemp:String;
  acFileName:Array [0..255] of Char;
begin
  Result:='';
 
  GetModuleFileName(HInstance,acFileName,SizeOf(acFileName)-1);
 
  dSize:=GetFileVersionInfoSize(acFileName,dSize);
 
  if dSize=0 then Exit;
 
  pcBuf:=AllocMem(dSize);
 
  GetFileVersionInfo(acFileName,0,dSize,pcBuf);
 
  if VerQueryValue(pcBuf, PChar('\VarFileInfo\Translation'),Pointer(pcValue),dLength) then
  begin
    for TempVersionLanguage := vlArabic to vlUnknown do
      if LoWord(Longint(Pointer(pcValue)^)) = LanguageValues[TempVersionLanguage] then Break;
 
    sTemp:=IntToHex(MakeLong(HiWord(Longint(Pointer(pcValue)^)),LoWord(Longint(Pointer(pcValue)^))), 8);
 
    if VerQueryValue(pcBuf,PChar('StringFileInfo\'+sTemp+'\FileVersion'),Pointer(pcValue),dLength) then
      Result:=StrPas(pcValue);
  end;
 
  FreeMem(pcBuf,dSize);
end;
 
 
{ ==============================================================================
  方法名稱:WMMOUSEWHEEL
  引用相依:
  方法描述:處理滑鼠滾輪事件。根據滾輪捲動方向(WHEEL_DELTA)對 ScrollBox1 或當前顯
            示的影像捲軸盒(DisplayISB)進行垂直捲動(SB_Lineup 或 SB_LINEDOWN)。若
            同時按下特定鍵(message.Keys=50),則會調整影像的縮放百分比(ZoomPercent
            )。此外也會遍歷所有影像捲軸盒元件並對取得焦點的元件執行捲動操作。
============================================================================== }
procedure TCB_IMGPSScanX.WMMOUSEWHEEL(var message: TWMMouseWheel);
var
  I: Integer;
  iISB : TImageScrollBox;
begin
    inherited;
    //lb1.Caption:=IntToStr(message.Keys);
    if (message.WheelDelta = WHEEL_DELTA) Then
    begin
 
      if ScrollBox1.Focused then
      begin
        ScrollBox1.VertScrollBar.Increment := 50;
        ScrollBox1.Perform(WM_VSCROLL,SB_Lineup,0);
      end;
      if DisplayISB <> nil then
      begin
        if (DisplayISB.Focused) and (message.Keys=0) then
        begin
           DisplayISB.VertScrollBar.Increment := 50;
           DisplayISB.Perform(WM_VSCROLL,SB_Lineup,0);
        end;
 
        if (DisplayISB.Focused) and (message.Keys=50) then
        begin
          DisplayISB.ZoomMode := zmPercent;
          if DisplayISB.ZoomPercent < 90 then
            DisplayISB.ZoomPercent := DisplayISB.ZoomPercent+10;
        end;
 
      end;
      i:=0;
      while FindComponent(ISBName+inttostr(i)) <> nil do
      begin
        iISB := TImageScrollBox(FindComponent(ISBName+inttostr(i)));
        if iISB.Focused then
        begin
          ScrollBox1.VertScrollBar.Increment := 50;
          ScrollBox1.Perform(WM_VSCROLL,SB_Lineup,0);
        end;
        inc(i);
      end;
 
    end
    else if (message.WheelDelta = -WHEEL_DELTA) then
    begin
 
      if ScrollBox1.Focused then
      begin
        ScrollBox1.VertScrollBar.Increment := 50;
        ScrollBox1.Perform(WM_VSCROLL, SB_LINEDOWN, 0);
      end;
      if DisplayISB <> nil then
      begin
        if (DisplayISB.Focused) and (message.Keys=0) then
        begin
           DisplayISB.VertScrollBar.Increment := 50;
           DisplayISB.Perform(WM_VSCROLL,SB_LINEDOWN,0);
        end;
        if (DisplayISB.Focused) and (message.Keys=50) then
        begin
          DisplayISB.ZoomMode := zmPercent;
          if DisplayISB.ZoomPercent > 10 then
            DisplayISB.ZoomPercent := DisplayISB.ZoomPercent-10;
        end;
 
 
      end;
 
      i:=0;
      while FindComponent(ISBName+inttostr(i)) <> nil do
      begin
        iISB := TImageScrollBox(FindComponent(ISBName+inttostr(i)));
        if iISB.Focused then
        begin
          ScrollBox1.VertScrollBar.Increment := 50;
          ScrollBox1.Perform(WM_VSCROLL,SB_Lineup,0);
        end;
        inc(i);
      end;
 
    end;
 
 
end;
 
 
{ ==============================================================================
  方法名稱:InitExistImgList
  引用相依:LoadFileGetMD5, LoadFromFile
  方法描述:初始化已存在的影像清單。讀取案件路徑下 Download\Context.dat 的檔案內
            容,計算每個檔案的 MD5 雜湊值並存入 ExistImgList,同時將處理過程記錄至
            日誌檔。
============================================================================== }
procedure TCB_IMGPSScanX.InitExistImgList(casepath: String);
var
  ST1,ST2,ST3,ST4:TStringList;
  i,j,k:Integer;
begin
 
  ST1:=TStringList.Create;
  ST2:=TStringList.Create;
  ST3:=TStringList.Create;
 
  ExistImgList.Clear;
  ST1.LoadFromFile(casepath+'Download\Context.dat');
  for I := 0 to ST1.Count - 1 do
  begin
LogFile1.LogToFile(logTimeString+casepath+'Download\'+ST1.Strings[i]+',MD5='+LoadFileGetMD5(casepath+'Download\'+ST1.Strings[i]));
    ExistImgList.Add(LoadFileGetMD5(casepath+'Download\'+ST1.Strings[i])) ;
  end;
LogFile1.LogToFile(logTimeString+'ExistImgList.text'+ExistImgList.CommaText);
 
  ST1.Free;
  ST2.Free;
  ST3.Free;
 
end;