RightMargin Example for C++ 5.0 and later

   ILEADRasterTwain * pltRasTwain; 
   ItwFrame * ptwFrame = NULL; 
   float m_RightMargin; 
   float m_LeftMargin; 
   float m_BottomMargin; 
   float m_TopMargin; 
   ILEADRasterVariant * CapVal = NULL; 
   CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL, 
                                   IID_ILEADRasterVariant, (void **)&CapVal); 

   ICapability * pCapability = NULL; 
   ICapabilityOneValue * pCapOV = NULL; 

   ::CoCreateInstance (CLSID_twFrame, NULL, CLSCTX_ALL, IID_ItwFrame, (void **)&ptwFrame); 
   if (ptwFrame) 
  {
      UpdateData (TRUE); 

      ptwFrame->put_
RightMargin(m_RightMargin); 
      ptwFrame->put_
LeftMargin(m_LeftMargin); 
      ptwFrame->put_
TopMargin(m_TopMargin); 
      ptwFrame->put_
BottomMargin(m_BottomMargin); 

      ::CoCreateInstance (CLSID_LEADRasterTwainCapability, NULL, CLSCTX_ALL, IID_ICapability, (void **)&pCapability); 
      pCapability->QueryInterface (IID_ICapabilityOneValue, (void **)&pCapOV); 

      pCapability->
EnableMethodErrors = FALSE; 
      pCapability->
Capability = L_ICAP_FRAMES; 
      pCapability->
ConType = L_TWON_ONEVALUE; 

      CapVal->Type = VALUE_DISPATCH; 
      CapVal->DispatchValue = ptwFrame; 
      

      pCapOV->put_
OneValItemType (L_TWTY_FRAME); 
      pCapOV->put_
OneValCapValue (CapVal); 

      pltRasTwain->
SetCapability (pCapability, L_LTWAIN_CAPABILITY_SET); 

      ptwFrame->Release();
      pCapOV->Release();
      pCapability->Release();
   }

   CapVal->Release();