Contents Index Topic Contents | ||
Previous Topic: IUniformResourceLocator Interface Next Topic: IUniformResourceLocator::InvokeCommand |
IUniformResourceLocator::GetURL
HRESULT GetURL( LPSTR *ppszURL );Retrieves an object's uniform resource locator (URL).
- Returns S_OK if the object's URL was retrieved successfully. If the object does not have a URL associated with it, the function returns S_FALSE and sets ppszURL to NULL. Otherwise, the return value is an error code that can be one of the following:
E_OUTOFMEMORY There is not enough memory to complete the operation. IS_E_EXEC_FAILED The URL's protocol handler failed to run. URL_E_INVALID_SYNTAX The URL's syntax is invalid. URL_E_UNREGISTERED_PROTOCOL The URL's protocol does not have a registered protocol handler.
- ppszURL
- Address of an LPSTR that will be filled in with a pointer to the object's URL. Because this method allocates memory for the string, you must instantiate an IMalloc interface and free the memory using IMalloc::Free when it is no longer needed. The following code fragment provides an example of how this can be done.
// START CODE FRAGMENT { // In this example, pURL is a global IUniformResourceLocator pointer. LPSTR lpTemp; hres = pURL->GetURL(&lpTemp); if (SUCCEEDED(hres)){ IMalloc* pMalloc; hres = SHGetMalloc(&pMalloc); if (SUCCEEDED(hres)){ pMalloc->Free(lpTemp); pMalloc->Release(); } } } // END CODE FRAGMENT
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.