1
下面的網頁介紹查詢Windows搜索程序:Windows搜索4查詢 - 德爾福例
http://msdn.microsoft.com/en-us/library/aa965362.aspx
是否採用Delphi /帕斯卡爾人有例子嗎?
例子我心目中是相當簡單:
- 某些文件類型的搜索。
- 搜索文件中的特定文本。
- 將上述搜索限制在某個路徑。
下面的網頁介紹查詢Windows搜索程序:Windows搜索4查詢 - 德爾福例
http://msdn.microsoft.com/en-us/library/aa965362.aspx
是否採用Delphi /帕斯卡爾人有例子嗎?
例子我心目中是相當簡單:
這裏有一個我做了,而前 - 要知道,它可能是過時的:
const GENERAL_COLUMNS = '"System.Itemname", "System.Size", "System.DateCreated", "System.ItemDate",' + '"System.ItemFolderPathDisplay", "System.Search.AutoSummary", "System.ItemType"'; IMAGE_COLUMNS = '"System.Image.HorizontalSize", "System.Image.VerticalSize", '+ '"System.Image.BitDepth", "System.Image.Compression", '+ '"System.Photo.CameraModel", "System.Photo.DateTaken", "System.Photo.Flash"'; MUSIC_COLUMNS = '"System.Music.Artist", "System.Music.Genre", "System.Music.TrackNumber", '+ '"System.Audio.Compression", "System.Audio.SampleRate", '+ '"System.DRM.IsProtected", "System.Music.AlbumTitle", "System.Rating", '+ '"System.Audio.EncodingBitrate"'; procedure TWDSDataSource.RetrieveDataFromDB; var manager : ISearchManager; catalogManager : ISearchCatalogManager; queryHelper : ISearchQueryHelper; wQuery : string; temp : PWideChar; sTemp : string; begin manager := CoCSearchManager.Create; if Succeeded(manager.GetCatalog('SystemIndex',catalogManager)) then begin if Succeeded(catalogManager.GetQueryHelper(queryHelper)) then begin if fMaxResults 0 then queryHelper.Set_QueryMaxResults(fMaxResults); queryHelper.Set_QuerySelectColumns(GENERAL_COLUMNS + ',' + MUSIC_COLUMNS + ',' + IMAGE_COLUMNS); queryHelper.GenerateSQLFromUserQuery(PWideChar(fQuery),temp); wQuery := temp; queryHelper.Get_ConnectionString(temp); sTemp := temp; dataset := CreateComObject(CLASS_Recordset) as _Recordset; dataset.CursorLocation := adUseClient; dataset.Open(wQuery, stemp, adOpenForwardOnly, adLockReadOnly, adCmdText); dataset.Set_ActiveConnection(nil); bDatabaseFailed := false; end else bDatabaseFailed := true; end else bDatabaseFailed := true; end;
我覺得這一切都非常自我解釋,fQuery是要執行查詢。
關注 Keith
謝謝你的示例代碼。這個單位的使用條款是什麼? – 2010-07-01 17:53:41
AdoDB,Windows,SysUtils,ComObj,Graphics,Variants,ShellApi,ShlObj,AdoInt,JPeg,Utils,SearchAPILib_tlb,ThreadSafeJpeg; 大多數可能是無關緊要的。 – 2010-07-02 09:16:24
我發現我需要以下使用條款: 使用Windows,SysUtils,Classes,DB,ComObj,AdoInt,SearchAPILib_TLB,ADODB; 最後的後續行動(我認爲):數據集定義爲什麼類型的組件?我假設它是TADODataset compoenent,但是我得到一個編譯錯誤,即Open過程有太多參數。 – 2010-07-02 16:36:24