共用方式為


IXpsOMObjectFactory::CreateColorProfileResource 方法 (xpsobjectmodel.h)

建立 IXpsOMColorProfileResource 介面,此介面可用來存取色彩配置檔資源數據流。

語法

HRESULT CreateColorProfileResource(
  [in]          IStream                    *acquiredStream,
  [in]          IOpcPartUri                *partUri,
  [out, retval] IXpsOMColorProfileResource **colorProfileResource
);

參數

[in] acquiredStream

要與此資源相關聯的唯讀 IStream 介面。 此參數不得為 NULL

重要 將此數據流視為 Single-Threaded Apartment (STA) 物件;請勿重新輸入。
 

[in] partUri

IOpcPartUri 介面,其中包含要指派給此資源的元件名稱。

[out, retval] colorProfileResource

IXpsOMColorProfileResource 介面的指標。

傳回值

方法會傳回 HRESULT。 可能的值包括下列數據表中的值,但不限於這些值。 如需此表格中未列出的 XPS 檔 API 傳回值的相關信息,請參閱 XPS 檔錯誤

傳回碼 描述
S_OK
此方法已成功。
E_POINTER
acquiredStreampartUricolorProfileResourceNULL

備註

下列程式代碼範例說明如何使用這個方法來建立新的介面。


IXpsOMColorProfileResource    *newInterface;
IOpcPartUri                   *partUri;

// Note the implicit requirement that CoInitializeEx 
//  has previously been called from this thread.

hr = CoCreateInstance(
    __uuidof(XpsOMObjectFactory),
    NULL,
    CLSCTX_INPROC_SERVER,
    _uuidof(IXpsOMObjectFactory),
    reinterpret_cast<LPVOID*>(&xpsFactory)
    );

if (SUCCEEDED(hr))
{
    // The partUriString and acquiredStream variables 
    //   are defined outside of this example.
    hr = xpsFactory->CreatePartUri(
        partUriString, 
        &partUri);
    if (SUCCEEDED(hr))
    {
        hr = xpsFactory->CreateColorProfileResource (
            acquiredStream, 
            partUri,
            &newInterface);
        if (SUCCEEDED(hr))
        {
            // use newInterface

            newInterface->Release();
        }
        partUri->Release();
    }
    xpsFactory->Release();
}
else
{
    // evaluate HRESULT error returned in hr
}

規格需求

需求
最低支援的用戶端 適用於 Windows Vista 的 Windows 7、Windows Vista SP2 和平臺更新 [傳統型應用程式 |UWP 應用程式]
最低支援的伺服器 Windows Server 2008 R2、Windows Server 2008 SP2 和 Platform Update for Windows Server 2008 [傳統型應用程式 |UWP 應用程式]
目標平台 Windows
標頭 xpsobjectmodel.h

另請參閱

IOpcPartUri

IXpsOMColorProfileResource

IXpsOMObjectFactory

XML Paper Specification

XPS 檔案錯誤