Search in sources :

Example 1 with DISPIDByReference

use of com.sun.jna.platform.win32.OaIdl.DISPIDByReference in project jna by java-native-access.

the class IDispatchTest method testGetIDsOfNames.

public void testGetIDsOfNames() {
    Dispatch dispatch = this.createIDispatch();
    WString[] ptName = new WString[] { new WString("Application") };
    DISPIDByReference pdispID = new DISPIDByReference();
    HRESULT hr = dispatch.GetIDsOfNames(new REFIID(Guid.IID_NULL), ptName, 1, LOCALE_SYSTEM_DEFAULT, pdispID);
    COMUtils.checkRC(hr);
    assertEquals(0, hr.intValue());
}
Also used : WString(com.sun.jna.WString) HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) DISPIDByReference(com.sun.jna.platform.win32.OaIdl.DISPIDByReference) REFIID(com.sun.jna.platform.win32.Guid.REFIID)

Example 2 with DISPIDByReference

use of com.sun.jna.platform.win32.OaIdl.DISPIDByReference in project jna by java-native-access.

the class ProxyObject method resolveDispId.

protected DISPID resolveDispId(final IDispatch pDisp, String name) {
    assert COMUtils.comIsInitialized() : "COM not initialized";
    if (pDisp == null)
        throw new COMException("pDisp (IDispatch) parameter is null!");
    // variable declaration
    final WString[] ptName = new WString[] { new WString(name) };
    final DISPIDByReference pdispID = new DISPIDByReference();
    // Get DISPID for name passed...
    HRESULT hr = pDisp.GetIDsOfNames(new REFIID(Guid.IID_NULL), ptName, 1, factory.getLCID(), pdispID);
    COMUtils.checkRC(hr);
    return pdispID.getValue();
}
Also used : WString(com.sun.jna.WString) COMException(com.sun.jna.platform.win32.COM.COMException) HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) DISPIDByReference(com.sun.jna.platform.win32.OaIdl.DISPIDByReference) REFIID(com.sun.jna.platform.win32.Guid.REFIID)

Example 3 with DISPIDByReference

use of com.sun.jna.platform.win32.OaIdl.DISPIDByReference in project jna by java-native-access.

the class COMBindingBaseObject method oleMethod.

protected HRESULT oleMethod(int nType, VARIANT.ByReference pvResult, IDispatch pDisp, String name, VARIANT[] pArgs) throws COMException {
    if (pDisp == null)
        throw new COMException("pDisp (IDispatch) parameter is null!");
    // variable declaration
    WString[] ptName = new WString[] { new WString(name) };
    DISPIDByReference pdispID = new DISPIDByReference();
    // Get DISPID for name passed...
    HRESULT hr = pDisp.GetIDsOfNames(new REFIID(Guid.IID_NULL), ptName, 1, LOCALE_USER_DEFAULT, pdispID);
    COMUtils.checkRC(hr);
    return this.oleMethod(nType, pvResult, pDisp, pdispID.getValue(), pArgs);
}
Also used : WString(com.sun.jna.WString) HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) DISPIDByReference(com.sun.jna.platform.win32.OaIdl.DISPIDByReference) REFIID(com.sun.jna.platform.win32.Guid.REFIID)

Aggregations

WString (com.sun.jna.WString)3 REFIID (com.sun.jna.platform.win32.Guid.REFIID)3 DISPIDByReference (com.sun.jna.platform.win32.OaIdl.DISPIDByReference)3 HRESULT (com.sun.jna.platform.win32.WinNT.HRESULT)3 COMException (com.sun.jna.platform.win32.COM.COMException)1