Search in sources :

Example 6 with ITypeInfo

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

the class ITypeInfoTest method testGetDocumentation.

@Test
public void testGetDocumentation() {
    ITypeInfo[] typeInfos = getTypeInfos();
    MEMBERID memid = new MEMBERID(0);
    BSTRByReference pBstrName = new BSTRByReference();
    BSTRByReference pBstrDocString = new BSTRByReference();
    DWORDByReference pdwHelpContext = new DWORDByReference();
    BSTRByReference pBstrHelpFile = new BSTRByReference();
    for (ITypeInfo typeInfo : typeInfos) {
        HRESULT hr = typeInfo.GetDocumentation(memid, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile);
        if (COMUtils.SUCCEEDED(hr)) {
            //System.out.println("pBstrHelpFile: " + pBstrHelpFile.getValue());
            return;
        }
    }
    throw new RuntimeException("Didn't find documentation in any of the type infos");
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) MEMBERID(com.sun.jna.platform.win32.OaIdl.MEMBERID) DWORDByReference(com.sun.jna.platform.win32.WinDef.DWORDByReference) BSTRByReference(com.sun.jna.platform.win32.WTypes.BSTRByReference) Test(org.junit.Test)

Example 7 with ITypeInfo

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

the class TypeLibUtil method getTypeInfo.

/**
     * Gets the type info.
     * 
     * @param index
     *            the index
     * @return the type info
     */
public ITypeInfo getTypeInfo(int index) {
    PointerByReference ppTInfo = new PointerByReference();
    HRESULT hr = this.typelib.GetTypeInfo(new UINT(index), ppTInfo);
    COMUtils.checkRC(hr);
    return new TypeInfo(ppTInfo.getValue());
}
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 8 with ITypeInfo

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

the class TypeInfoUtil method getRefTypeInfo.

/**
     * Gets the ref type info.
     * 
     * @param hreftype
     *            the hreftype
     * @return the ref type info
     */
public ITypeInfo getRefTypeInfo(HREFTYPE hreftype) {
    PointerByReference ppTInfo = new PointerByReference();
    HRESULT hr = this.typeInfo.GetRefTypeInfo(hreftype, ppTInfo);
    COMUtils.checkRC(hr);
    return new TypeInfo(ppTInfo.getValue());
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) PointerByReference(com.sun.jna.ptr.PointerByReference)

Example 9 with ITypeInfo

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

the class TlbAbstractMethod method getUserdefinedType.

protected String getUserdefinedType(HREFTYPE hreftype) {
    ITypeInfo refTypeInfo = this.typeInfoUtil.getRefTypeInfo(hreftype);
    TypeInfoUtil typeInfoUtil = new TypeInfoUtil(refTypeInfo);
    TypeInfoDoc documentation = typeInfoUtil.getDocumentation(OaIdl.MEMBERID_NIL);
    return documentation.getName();
}
Also used : TypeInfoUtil(com.sun.jna.platform.win32.COM.TypeInfoUtil) TypeInfoDoc(com.sun.jna.platform.win32.COM.TypeInfoUtil.TypeInfoDoc) ITypeInfo(com.sun.jna.platform.win32.COM.ITypeInfo)

Example 10 with ITypeInfo

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

the class ITypeInfoTest method testAddressOfMember.

@Test
@Ignore("Needs a DLL that contains code")
public void testAddressOfMember() {
    ITypeInfo[] typeInfos = getTypeInfos();
    MEMBERID memid = new MEMBERID();
    PointerByReference ppv = new PointerByReference();
    for (ITypeInfo typeInfo : typeInfos) {
        HRESULT hr = typeInfo.AddressOfMember(memid, INVOKEKIND.INVOKE_FUNC, ppv);
        if (COMUtils.SUCCEEDED(hr)) {
            //System.out.println("AddressOfMember: " + ppv.toString());
            return;
        }
    }
    throw new RuntimeException("Didn't find address for function in any of the type infos");
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) MEMBERID(com.sun.jna.platform.win32.OaIdl.MEMBERID) PointerByReference(com.sun.jna.ptr.PointerByReference) 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