Partager via


CreateFileMoniker

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function creates a file moniker based on the specified path.

Syntax

WINOLEAPI CreateFileMoniker(
  LPCOLESTR lpszPathName,
  LPMONIKER FAR* ppmk
);

Parameters

  • lpszPathName
    [in] Pointer to a zero-terminated wide character string (two bytes per character) containing the path on which this moniker is based.
  • ppmk
    [out] Address of IMoniker* pointer variable that receives the interface pointer to the new file moniker. When successful, the function has called IUnknown::AddRef on the file moniker and the caller is responsible for calling IUnknown::Release. When an error occurs, the value of the interface pointer is NULL.

Return Value

This function supports the standard return value E_OUTOFMEMORY, as well as the following:

  • S_OK
    The moniker has been created successfully.
  • MK_E_SYNTAX
    Error in the syntax of a path was encountered while creating a moniker.

Remarks

CreateFileMoniker creates a moniker for an object that is stored in a file.

A moniker provider (an object that provides monikers to other objects) can call this function to create a moniker to identify a file-based object that it controls, and can then make the pointer to this moniker available to other objects.

An object identified by a file moniker must also implement the IPersistFile interface so it can be loaded when a file moniker is bound.

When each object resides in its own file, as in an OLE server application that supports linking only to file-based documents in their entirety, file monikers are the only type of moniker necessary.

To identify objects smaller than a file, the moniker provider must use another type of moniker (such as an item moniker) in addition to file monikers, creating a composite moniker.

Composite monikers would be needed in an OLE server application that supports linking to objects smaller than a document (such as sections of a document or embedded objects).

The lpszPathName can be a relative path, a UNC path (for example, \\server\share\path), or a drive-letter-based path (for example, c:\). If based on a relative path, the resulting moniker must be composed onto another file moniker before it can be bound.

A file moniker can be composed to the right only of another file moniker when the first moniker is based on an absolute path and the other is a relative path, resulting in a single file moniker based on the combination of the two paths.

A moniker composed to the right of another moniker must be a refinement of that moniker, and the file moniker represents the largest unit of storage. To identify objects stored within a file, you would compose other types of monikers (usually item monikers) to the right of a file moniker.

To determine whether the platform supports this function, see Determining Supported COM APIs.

Requirements

Header objbase.h
Library ole32.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

COM Functions