Hex Editor
Hex Editor - Binary File Editing Software for Windows

IFileDocument.FindAllS Method

HHD Software - Hex Editor Serial Port Monitor USB Protocol Analyzer Network Monitor
 
 
 
< PreviousTopNext >
Declaration
Automation:
void  FindAllS ( [in]   ISequence  pSequence, [in]   IMultiSelection  pSelection, [in]   bool  ignore_case, [in]   IMultiSelection  pFound) ;
Native (C++):
HRESULT  FindAllS ( [in]   ISequence *  pSequence, [in]   IMultiSelection *  pSelection, [in]   BOOL  ignore_case, [in]   IMultiSelection *  pFound) ;
Parameters
pSequenceSequence object containing a find pattern.pSelectionMultiple Selection object, which contains ranges in which a pattern need to be locatedignore_caseTrue to ignore case, False to perform exact matching.pFoundMultiple Selection object, which contains, on method's return, all located ranges.
Return Value
S_OK or standard OLE error code.
Remarks

Locates all occurrences of a given pattern within a given multiple selection. You provide the function with an output Multiple Selection object pFound, in which it stores all located ranges. This object is automatically cleared before the operation begins. When the method returns, check the IMultiSelection.Empty property to see if there were any pattern occurrences. Complexity: linear-time, depending on the file's size and selection's complexity.

This method is a replacement for IFileDocument.FindAll when used in scripting languages.

Examples

Searching all pattern occurrences

C#Copy Code
var fdoc = new ActiveXObject("FileDocument.FileDocument");
var msel = fdoc.CreateEmptySelection();
var mselOutput = fdoc.CreateEmptySelection();

fdoc.Open("c:\\temp\\file.txt");
msel.AddRange(0, fdoc.FileSize);  // We'll be searching in a whole file

var pattern = fdoc.CreateSequence();
pattern.AddData(HexBytes, 0x0d, 0x0a); // EOL pattern
fdoc.FindAllS(pattern, msel, false, mselOutput);
if (!mselOutput.Empty) // check if there are any matches
  fdoc.Copy(mselOutput,false);  // copy them to the Clipboard
    
< PreviousTopNext >
Copyright © 2012 HHD Software. All rights reserved.