CICreateCommand function
[Indexing Service is no longer supported as of Windows XP and is unavailable for use as of Windows 8. Instead, use Windows Search for client side search and Microsoft Search Server Express for server side search.]
Creates a Command object.
Syntax
HRESULT __stdcall CICreateCommand( IUnknown **ppCommand, IUnknown *pUnkOuter, REFIID riid, const WCHAR *pwcsCatalog, const WCHAR *pwcsMachine );
Parameters
- ppCommand
-
A pointer to a variable that receives the IUnknown interface pointer requested in riid.
- pUnkOuter
-
A pointer to an optional outer IUnknown interface. This parameter can be zero for no aggregation, in which case riid can contain a value other than IID_IUnknown.
- riid
-
The interface identifier (IID) of the interface returned in ppCommand. This parameter must be IID_IUnknown unless pUnkOuter is NULL. Pass IID_ICommand to get an ICommand interface if aggregation isn't needed and pUnkOuter is NULL.
- pwcsCatalog
-
The name of the catalog to be used to execute queries. This is the value for the DBPROP_CI_CATALOG_NAME property of the ICommand interface.
- pwcsMachine
-
The name of the computer on which the query is to be executed. This is the value for the DBPROP_CI_MACHINE_NAME property of the ICommand interface. Use L"." for the local computer.
Return value
This function can return one of these values.
| Return code | Description |
|---|---|
|
The operation was completed successfully. |
|
Aggregation exists (pUnkOuter is not NULL) and riid is not IID_IUnknown. |
|
The function received an invalid parameter. |
Remarks
The CICreateCommand function simplifies the task of connecting to the Indexing Service content and property indexes as an OLE DB provider data source object (DSO) and creating a session object. Queries made with the resulting ICommand interface default to the scope "\" and search everywhere under that hierarchy (a "deep" search). To specify a scope, use CIMakeICommand.
If interface aggregation isn't required, pass IID_ICommand for riid and NULL for pUnkOuter. Otherwise, call IUnknown::QueryInterface on the returned object to get an ICommand interface.
The CICreateCommand function does not return an error if the catalog or computer do not exist or are not available. The connection to the catalog and computer are established when the ICommand::Execute method is called, and connection errors are returned at that time.
Additional catalog, computer, and scope parameters can be specified after an ICommand interface is created using the ICommandProperties interface.
A pointer to a null-terminated string that specifies the name of the machine on which the query is executed. This is the value for the DBPROP_CI_MACHINE_NAME property of the ICommand interface. Use L"." for the local computer.
Examples
This example creates an ICommand interface for the system catalog on the local machine.
ICommand * pICommand;
HRESULT hr = CICreateCommand( (IUnknown **) &pICommand, 0, IID_ICommand, L"system", L"." );
if ( SUCCEEDED( hr ) )
{
// ...
// execute one or more queries with the ICommand
// ...
pICommand->Release();
}
Requirements
|
Minimum supported client |
Windows 2000 Professional [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps only] |
|
End of client support |
Windows 7 |
|
End of server support |
Windows Server 2008 R2 |
|
Header |
|
|
Library |
|
|
DLL |
|
See also