Search in sources :

Example 11 with UINT

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

the class TypeInfoUtil method getIDsOfNames.

/**
     * Gets the i ds of names.
     * 
     * @param rgszNames
     *            the rgsz names
     * @param cNames
     *            the c names
     * @return the i ds of names
     */
public MEMBERID[] getIDsOfNames(LPOLESTR[] rgszNames, int cNames) {
    MEMBERID[] pMemId = new MEMBERID[cNames];
    HRESULT hr = this.typeInfo.GetIDsOfNames(rgszNames, new UINT(cNames), pMemId);
    COMUtils.checkRC(hr);
    return pMemId;
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) MEMBERID(com.sun.jna.platform.win32.OaIdl.MEMBERID) UINT(com.sun.jna.platform.win32.WinDef.UINT)

Example 12 with UINT

use of com.sun.jna.platform.win32.WinDef.UINT 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 13 with UINT

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

the class IDispatchTest method testGetTypeInfo.

public void testGetTypeInfo() {
    Dispatch dispatch = this.createIDispatch();
    PointerByReference ppTInfo = new PointerByReference();
    HRESULT hr = dispatch.GetTypeInfo(new UINT(0), LOCALE_SYSTEM_DEFAULT, ppTInfo);
    COMUtils.checkRC(hr);
    assertEquals(0, hr.intValue());
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) PointerByReference(com.sun.jna.ptr.PointerByReference) UINT(com.sun.jna.platform.win32.WinDef.UINT)

Example 14 with UINT

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

the class ITypeInfoTest method testGetRefTypeOfImplType.

@Test
public void testGetRefTypeOfImplType() {
    ITypeInfo typeInfo = getTypeInfo();
    HREFTYPEByReference pRefType = new HREFTYPEByReference();
    HRESULT hr = typeInfo.GetRefTypeOfImplType(new UINT(0), pRefType);
    COMUtils.checkRC(hr);
    assertEquals(0, hr.intValue());
//System.out.println("GetRefTypeOfImplType: " + pRefType.toString());
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) HREFTYPEByReference(com.sun.jna.platform.win32.OaIdl.HREFTYPEByReference) UINT(com.sun.jna.platform.win32.WinDef.UINT) Test(org.junit.Test)

Example 15 with UINT

use of com.sun.jna.platform.win32.WinDef.UINT 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

UINT (com.sun.jna.platform.win32.WinDef.UINT)17 HRESULT (com.sun.jna.platform.win32.WinNT.HRESULT)15 PointerByReference (com.sun.jna.ptr.PointerByReference)7 Test (org.junit.Test)5 MEMBERID (com.sun.jna.platform.win32.OaIdl.MEMBERID)3 HREFTYPEByReference (com.sun.jna.platform.win32.OaIdl.HREFTYPEByReference)2 TYPEKIND (com.sun.jna.platform.win32.OaIdl.TYPEKIND)2 BSTR (com.sun.jna.platform.win32.WTypes.BSTR)2 UINTByReference (com.sun.jna.platform.win32.WinDef.UINTByReference)2 USHORTByReference (com.sun.jna.platform.win32.WinDef.USHORTByReference)2 IntByReference (com.sun.jna.ptr.IntByReference)2 Pointer (com.sun.jna.Pointer)1 COMException (com.sun.jna.platform.win32.COM.COMException)1 IConnectionPoint (com.sun.jna.platform.win32.COM.util.IConnectionPoint)1 ObjectFactory (com.sun.jna.platform.win32.COM.util.ObjectFactory)1 ComObject (com.sun.jna.platform.win32.COM.util.annotation.ComObject)1 FUNCDESC (com.sun.jna.platform.win32.OaIdl.FUNCDESC)1 SAFEARRAY (com.sun.jna.platform.win32.OaIdl.SAFEARRAY)1 VARDESC (com.sun.jna.platform.win32.OaIdl.VARDESC)1 VARIANT (com.sun.jna.platform.win32.Variant.VARIANT)1