Search in sources :

Example 1 with UINTByReference

use of com.sun.jna.platform.win32.WinDef.UINTByReference in project jna by java-native-access.

the class TypeInfoUtil method GetContainingTypeLib.

/**
     * Gets the containing type lib.
     * 
     * @return the containing type lib
     */
public ContainingTypeLib GetContainingTypeLib() {
    PointerByReference ppTLib = new PointerByReference();
    UINTByReference pIndex = new UINTByReference();
    HRESULT hr = this.typeInfo.GetContainingTypeLib(ppTLib, pIndex);
    COMUtils.checkRC(hr);
    return new ContainingTypeLib(new TypeLib(ppTLib.getValue()), pIndex.getValue().intValue());
}
Also used : UINTByReference(com.sun.jna.platform.win32.WinDef.UINTByReference) HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) PointerByReference(com.sun.jna.ptr.PointerByReference)

Example 2 with UINTByReference

use of com.sun.jna.platform.win32.WinDef.UINTByReference in project jna by java-native-access.

the class TypeInfoUtil method Invoke.

/**
     * Invoke.
     * 
     * @param pvInstance
     *            the pv instance
     * @param memid
     *            the memid
     * @param wFlags
     *            the w flags
     * @param pDispParams
     *            the disp params
     * @return the invoke
     */
public Invoke Invoke(PVOID pvInstance, MEMBERID memid, WORD wFlags, DISPPARAMS.ByReference pDispParams) {
    VARIANT.ByReference pVarResult = new VARIANT.ByReference();
    EXCEPINFO.ByReference pExcepInfo = new EXCEPINFO.ByReference();
    UINTByReference puArgErr = new UINTByReference();
    HRESULT hr = this.typeInfo.Invoke(pvInstance, memid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
    COMUtils.checkRC(hr);
    return new Invoke(pVarResult, pExcepInfo, puArgErr.getValue().intValue());
}
Also used : UINTByReference(com.sun.jna.platform.win32.WinDef.UINTByReference) HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) EXCEPINFO(com.sun.jna.platform.win32.OaIdl.EXCEPINFO) HREFTYPEByReference(com.sun.jna.platform.win32.OaIdl.HREFTYPEByReference) UINTByReference(com.sun.jna.platform.win32.WinDef.UINTByReference) DWORDByReference(com.sun.jna.platform.win32.WinDef.DWORDByReference) BSTRByReference(com.sun.jna.platform.win32.WTypes.BSTRByReference) PointerByReference(com.sun.jna.ptr.PointerByReference) WORDByReference(com.sun.jna.platform.win32.WinDef.WORDByReference) IntByReference(com.sun.jna.ptr.IntByReference) VARIANT(com.sun.jna.platform.win32.Variant.VARIANT)

Example 3 with UINTByReference

use of com.sun.jna.platform.win32.WinDef.UINTByReference in project jna by java-native-access.

the class TypeInfoUtil method getNames.

/**
     * Gets the names.
     * 
     * @param memid
     *            the memid
     * @param maxNames
     *            the max names
     * @return the names
     */
public String[] getNames(MEMBERID memid, int maxNames) {
    BSTR[] rgBstrNames = new BSTR[maxNames];
    UINTByReference pcNames = new UINTByReference();
    HRESULT hr = this.typeInfo.GetNames(memid, rgBstrNames, new UINT(maxNames), pcNames);
    COMUtils.checkRC(hr);
    int cNames = pcNames.getValue().intValue();
    String[] result = new String[cNames];
    for (int i = 0; i < result.length; i++) {
        result[i] = rgBstrNames[i].getValue();
        OLEAUTO.SysFreeString(rgBstrNames[i]);
    }
    return result;
}
Also used : BSTR(com.sun.jna.platform.win32.WTypes.BSTR) UINTByReference(com.sun.jna.platform.win32.WinDef.UINTByReference) HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) UINT(com.sun.jna.platform.win32.WinDef.UINT)

Example 4 with UINTByReference

use of com.sun.jna.platform.win32.WinDef.UINTByReference in project jna by java-native-access.

the class IDispatchTest method testGetTypeInfoCount.

public void testGetTypeInfoCount() {
    Dispatch dispatch = this.createIDispatch();
    UINTByReference pctinfo = new UINTByReference();
    dispatch.GetTypeInfoCount(pctinfo);
    int intValue = pctinfo.getValue().intValue();
    assertEquals(1, intValue);
}
Also used : UINTByReference(com.sun.jna.platform.win32.WinDef.UINTByReference)

Example 5 with UINTByReference

use of com.sun.jna.platform.win32.WinDef.UINTByReference in project jna by java-native-access.

the class ITypeInfoTest method testGetNames.

@Test
public void testGetNames() {
    ITypeInfo[] typeInfos = getTypeInfos();
    MEMBERID memid = new MEMBERID(1);
    BSTR[] rgBstrNames = new BSTR[1];
    UINT cMaxNames = new UINT(1);
    UINTByReference pcNames = new UINTByReference();
    for (ITypeInfo typeInfo : typeInfos) {
        HRESULT hr = typeInfo.GetNames(memid, rgBstrNames, cMaxNames, pcNames);
        if (COMUtils.SUCCEEDED(hr)) {
            //System.out.println("pcNames: " + pcNames.getValue().intValue());
            return;
        }
    }
    throw new RuntimeException("Didn't find name for member in any of the type infos");
}
Also used : BSTR(com.sun.jna.platform.win32.WTypes.BSTR) UINTByReference(com.sun.jna.platform.win32.WinDef.UINTByReference) HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) MEMBERID(com.sun.jna.platform.win32.OaIdl.MEMBERID) UINT(com.sun.jna.platform.win32.WinDef.UINT) Test(org.junit.Test)

Aggregations

UINTByReference (com.sun.jna.platform.win32.WinDef.UINTByReference)5 HRESULT (com.sun.jna.platform.win32.WinNT.HRESULT)4 BSTR (com.sun.jna.platform.win32.WTypes.BSTR)2 UINT (com.sun.jna.platform.win32.WinDef.UINT)2 PointerByReference (com.sun.jna.ptr.PointerByReference)2 EXCEPINFO (com.sun.jna.platform.win32.OaIdl.EXCEPINFO)1 HREFTYPEByReference (com.sun.jna.platform.win32.OaIdl.HREFTYPEByReference)1 MEMBERID (com.sun.jna.platform.win32.OaIdl.MEMBERID)1 VARIANT (com.sun.jna.platform.win32.Variant.VARIANT)1 BSTRByReference (com.sun.jna.platform.win32.WTypes.BSTRByReference)1 DWORDByReference (com.sun.jna.platform.win32.WinDef.DWORDByReference)1 WORDByReference (com.sun.jna.platform.win32.WinDef.WORDByReference)1 IntByReference (com.sun.jna.ptr.IntByReference)1 Test (org.junit.Test)1