{ ============================================================================== 方法名稱: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;