Structured Query sample
This sample demonstrates using the Structured Query API for parsing queries in Advanced Query Syntax (AQS), with the results represented by condition trees, a recursively defined data structure. The sample also demonstrates recursive traversal of condition trees. Finally, the sample demonstrates some Windows 7 improvements in the Structured Query API by having some sections of the code in two versions: a more elegant version that will run only on Windows 7 and a version using only APIs also available on Windows Vista.
This sample is available in the following language implementations: C++
Sample files
| File | Description |
|---|---|
| ReadMe.txt | This file. |
| StructuredQuerySample.cpp | The main file, containing all code for the sample. In the begnning there is a commented out line that should be uncommented to build an executable that will run successfully also on Vista. |
| StructuredQuerySample.sln | Visual Studio 2008 solution file. |
| StructuredQuerySample.vcproj | Visual Studio 2008 project file. |
To build the sample using the command prompt
- Open the Command Prompt window and navigate to the directory.
- Type msbuild StructuredQuerySample.sln.
To build the sample using Visual Studio 2008 (preferred method)
- Open Windows Explorer and navigate to the directory.
- Double-click the icon for the StructuredQuerySample.sln file to open it in Visual Studio.
- In the Build menu, select Build Solution. The application will be built in the default Debug or Release directory.
To run the sample
- Navigate to the directory that contains the new executable by using the command prompt or Windows Explorer.
- Type StructuredQuerySample.exe at the command line, or double-click the icon for StructuredQuerySample.exe to launch it from Windows Explorer.
- Type an AQS query (such as
from:billorfile:\*.txt modified:this month) followed by Enter. The program will display a tree representation of the resulting condition tree. - Repeat step 3 as desired. Terminate the program by typing Enter.