[][src]Macro comedy::com_call

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

Call a COM method, returning a Result.

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.

QueryInterface is not used, the receiving interface must already be the given type.

Example

fn cancel_job(job: &ComRef<IBackgroundCopyJob>) -> Result<(), HResult> {
    unsafe {
        com_call!(job, IBackgroundCopyJob::Cancel())?;
    }
    Ok(())
}