[][src]Macro comedy::com_call_taskmem_getter

macro_rules! com_call_taskmem_getter {
    (| $outparam:ident | $obj:expr, $interface:ident :: $method:ident ( $($arg:expr),* )) => { ... };
    (| $outparam:ident | $obj:expr, $interface:ident :: $method:ident ( $($arg:expr),+ , )) => { ... };
}

Call a COM method, create a CoTaskMem from an output parameter.

An error is returned if the call fails or if the pointer is null. The error is augmented with the name of the interface and method, and the file name and line number of the macro usage.

Null

If the method succeeds but the resulting pointer is null, this will return an HResult error with the successful return code.

Example

fn get_error_description(bcm: &ComRef<IBackgroundCopyManager>, lang_id: u32, hr: HRESULT)
    -> Result<CoTaskMem<u16>, HResult>
{
    unsafe {
        com_call_taskmem_getter!(
            |desc| bcm,
            IBackgroundCopyManager::GetErrorDescription(hr, lang_id, desc)
        )
    }
}