Search in sources :

Example 1 with IConnectionPoint

use of com.sun.jna.platform.win32.COM.util.IConnectionPoint in project jna by java-native-access.

the class ProxyObject method fetchRawConnectionPoint.

// ---------------------- IConnectionPoint ----------------------
private ConnectionPoint fetchRawConnectionPoint(IID iid) throws InterruptedException, ExecutionException, TimeoutException {
    assert COMUtils.comIsInitialized() : "COM not initialized";
    // query for ConnectionPointContainer
    IConnectionPointContainer cpc = this.queryInterface(IConnectionPointContainer.class);
    Dispatch rawCpcDispatch = (Dispatch) cpc.getRawDispatch();
    final ConnectionPointContainer rawCpc = new ConnectionPointContainer(rawCpcDispatch.getPointer());
    // find connection point for comEventCallback interface
    final REFIID adviseRiid = new REFIID(iid.getPointer());
    final PointerByReference ppCp = new PointerByReference();
    HRESULT hr = rawCpc.FindConnectionPoint(adviseRiid, ppCp);
    COMUtils.checkRC(hr);
    final ConnectionPoint rawCp = new ConnectionPoint(ppCp.getValue());
    return rawCp;
}
Also used : ConnectionPointContainer(com.sun.jna.platform.win32.COM.ConnectionPointContainer) HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) PointerByReference(com.sun.jna.ptr.PointerByReference) Dispatch(com.sun.jna.platform.win32.COM.Dispatch) IDispatch(com.sun.jna.platform.win32.COM.IDispatch) REFIID(com.sun.jna.platform.win32.Guid.REFIID) ConnectionPoint(com.sun.jna.platform.win32.COM.ConnectionPoint)

Aggregations

ConnectionPoint (com.sun.jna.platform.win32.COM.ConnectionPoint)1 ConnectionPointContainer (com.sun.jna.platform.win32.COM.ConnectionPointContainer)1 Dispatch (com.sun.jna.platform.win32.COM.Dispatch)1 IDispatch (com.sun.jna.platform.win32.COM.IDispatch)1 REFIID (com.sun.jna.platform.win32.Guid.REFIID)1 HRESULT (com.sun.jna.platform.win32.WinNT.HRESULT)1 PointerByReference (com.sun.jna.ptr.PointerByReference)1