Template:AVO Sample of create and Initialize

From AVObjects Knowledge Base
(Difference between revisions)
Jump to: navigation, search
 
Line 1: Line 1:
 
===Create and Initialize===
 
===Create and Initialize===
 
<source lang=cpp>
 
<source lang=cpp>
  //---------------------------------
+
//---------------------------------
  // Create {{{1}}} object
+
// Create {{{1}}} object
  CComPtr<IAVObject>; spReader;
+
CComPtr<IAVObject>; spReader;
  
  HRESULT hr = Create_{{{1}}}(&spReader);  
+
HRESULT hr = Create_{{{1}}}(&spReader);  
  if (hr != S_OK)
+
if (hr != S_OK)
    return hr;
+
  return hr;
  
  //---------------------------------
+
//---------------------------------
  // Query IAVProperties interface
+
// Query IAVProperties interface
  CComQIPtr<IAVProperties> spProps(spReader);
+
CComQIPtr<IAVProperties> spProps(spReader);
  ATLASSERT(spProps != NULL);
+
ATLASSERT(spProps != NULL);
  
  //---------------------------------
+
//---------------------------------
  // Set filename
+
// Set filename
  hr = spProps->PropsSet(L"source", L"filename.ext");
+
hr = spProps->PropsSet(L"source", L"filename.ext");
  if(hr != S_OK)
+
if(hr != S_OK)
    return hr;
+
  return hr;
  
  //---------------------------------
+
//---------------------------------
  // Init Object
+
// Init Object
  hr = spReader->Init();
+
hr = spReader->Init();
  if(hr != S_OK)
+
if(hr != S_OK)
    return hr;
+
  return hr;
 
</source>
 
</source>

Latest revision as of 08:41, 11 July 2014

Create and Initialize

//---------------------------------
// Create {{{1}}} object
CComPtr<IAVObject>;	spReader;
 
HRESULT hr = Create_{{{1}}}(&spReader); 
if (hr != S_OK)
   return hr;
 
//---------------------------------
// Query IAVProperties interface
CComQIPtr<IAVProperties> spProps(spReader);
ATLASSERT(spProps != NULL);
 
//---------------------------------
// Set filename
hr = spProps->PropsSet(L"source", L"filename.ext");
if(hr != S_OK)
  return hr;
 
//---------------------------------
// Init Object
hr = spReader->Init();
if(hr != S_OK)
  return hr;
Personal tools