Search in sources :

Example 11 with ITypeInfo

use of com.sun.jna.platform.win32.COM.ITypeInfo 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 12 with ITypeInfo

use of com.sun.jna.platform.win32.COM.ITypeInfo 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)

Example 13 with ITypeInfo

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

the class ITypeInfoTest method testGetIDsOfNames.

@Test
public void testGetIDsOfNames() {
    ITypeInfo[] typeInfos = getTypeInfos();
    LPOLESTR[] rgszNames = { new LPOLESTR("Help") };
    UINT cNames = new UINT(1);
    MEMBERID[] pMemId = new MEMBERID[1];
    for (ITypeInfo typeInfo : typeInfos) {
        HRESULT hr = typeInfo.GetIDsOfNames(rgszNames, cNames, pMemId);
        if (COMUtils.SUCCEEDED(hr)) {
            //System.out.println("pMemId: " + pMemId.toString());
            return;
        }
    }
    throw new RuntimeException("Didn't find Help in any of the type infos");
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) MEMBERID(com.sun.jna.platform.win32.OaIdl.MEMBERID) LPOLESTR(com.sun.jna.platform.win32.WTypes.LPOLESTR) UINT(com.sun.jna.platform.win32.WinDef.UINT) Test(org.junit.Test)

Example 14 with ITypeInfo

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

the class ITypeInfoTest method testGetDllEntry.

@Test
@Ignore("Needs a DLL that contains code")
public void testGetDllEntry() {
    ITypeInfo[] typeInfos = getTypeInfos();
    MEMBERID memid = new MEMBERID(0);
    BSTRByReference pBstrDllName = new BSTRByReference();
    BSTRByReference pBstrName = new BSTRByReference();
    WORDByReference pwOrdinal = new WORDByReference();
    for (ITypeInfo typeInfo : typeInfos) {
        HRESULT hr = typeInfo.GetDllEntry(memid, INVOKEKIND.INVOKE_FUNC, pBstrDllName, pBstrName, pwOrdinal);
        if (COMUtils.SUCCEEDED(hr)) {
            //System.out.println("pwOrdinal: " + pwOrdinal.getValue());
            return;
        }
    }
    throw new RuntimeException("Didn't find Dll entry for member in any of the type infos");
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) MEMBERID(com.sun.jna.platform.win32.OaIdl.MEMBERID) BSTRByReference(com.sun.jna.platform.win32.WTypes.BSTRByReference) DWORDByReference(com.sun.jna.platform.win32.WinDef.DWORDByReference) WORDByReference(com.sun.jna.platform.win32.WinDef.WORDByReference) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

HRESULT (com.sun.jna.platform.win32.WinNT.HRESULT)12 Test (org.junit.Test)8 MEMBERID (com.sun.jna.platform.win32.OaIdl.MEMBERID)7 UINT (com.sun.jna.platform.win32.WinDef.UINT)6 PointerByReference (com.sun.jna.ptr.PointerByReference)5 BSTRByReference (com.sun.jna.platform.win32.WTypes.BSTRByReference)3 TypeInfoDoc (com.sun.jna.platform.win32.COM.TypeInfoUtil.TypeInfoDoc)2 TYPEATTR (com.sun.jna.platform.win32.OaIdl.TYPEATTR)2 DWORDByReference (com.sun.jna.platform.win32.WinDef.DWORDByReference)2 Ignore (org.junit.Ignore)2 ITypeInfo (com.sun.jna.platform.win32.COM.ITypeInfo)1 TypeInfoUtil (com.sun.jna.platform.win32.COM.TypeInfoUtil)1 FindName (com.sun.jna.platform.win32.COM.TypeLibUtil.FindName)1 OaIdl (com.sun.jna.platform.win32.OaIdl)1 FUNCDESC (com.sun.jna.platform.win32.OaIdl.FUNCDESC)1 HREFTYPEByReference (com.sun.jna.platform.win32.OaIdl.HREFTYPEByReference)1 BSTR (com.sun.jna.platform.win32.WTypes.BSTR)1 LPOLESTR (com.sun.jna.platform.win32.WTypes.LPOLESTR)1 UINTByReference (com.sun.jna.platform.win32.WinDef.UINTByReference)1 WORDByReference (com.sun.jna.platform.win32.WinDef.WORDByReference)1