CreateURLMoniker function

Deprecated in Windows Internet Explorer 7. Use CreateURLMonikerEx instead.

Syntax

HRESULT CreateURLMoniker(
  _In_  IMoniker *pMkCtx,
  _In_  LPCWSTR  szURL,
  _Out_ IMoniker **ppmk
);

Parameters

  • pMkCtx [in]
    The address of the IMoniker interface for the URL moniker to use as the base context when the szURL parameter is a partial URL string. The pMkCtx parameter can be NULL.

  • szURL [in]
    The address of a string value that contains the display name to be parsed.

  • ppmk [out]
    Pointer to an IMoniker interface for the new URL moniker.

Return value

Returns one of the following values.

Return code Description
S_OK

Success.

E_OUTOFMEMORY

The operation ran out of memory.

MK_E_SYNTAX

A moniker cannot be created because szURL does not correspond to valid URL syntax for a full or partial URL. This is uncommon, because most parsing of the URL occurs during binding, and the syntax for URLs is extremely flexible.

 

Remarks

The CreateURLMoniker function creates a URL moniker from a full URL string, or from a base context URL moniker and a partial URL string.

Security Warning: This function does not correctly interpret percent encoded octets in Windows file paths or "file://" scheme Uniform Resource Identifiers (URIs). On systems with Microsoft Internet Explorer 6 and earlier, calling CreateURLMoniker with the output of a previous call might produce a result that is not equivalent. Since CreateURLMoniker can produce results that are not equivalent to the input, its use can result in security problems.

Use CreateURLMonikerEx with the URL_MK_UNIFORM flag to ensure that Windows file paths and "file://" URIs are interpreted correctly with regard to percent encoded octets; and that the result is equivalent to the input. To correctly extract a Windows file path from the result of CreateURLMoniker, use the PathCreateFromUrl function.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Product

Internet Explorer 3.0

Header

Urlmon.h

Library

Urlmon.lib

DLL

Urlmon.dll

See also

Internet Explorer Blog: CreateURLMoniker Considered Harmful