[][src]Macro comedy::com_call_getter

macro_rules! com_call_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 ComRef from an output parameter.

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

Null and Enumerators

If the method succeeds but the resulting interface pointer is null, this will return an HResult error with the successful return code. In particular this can happen with enumeration interfaces, which return S_FALSE when they write less than the requested number of results.

Example


fn create_job(bcm: &ComRef<IBackgroundCopyManager>, id: &GUID)
    -> Result<ComRef<IBackgroundCopyJob>, HResult>
{
    unsafe {
        com_call_getter!(
            |job| bcm,
            IBackgroundCopyManager::GetJob(id, job)
        )
    }
}