Search in sources :

Example 1 with TypeInfoDoc

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

the class TypeLibUtilTest method testGetTypeInfo.

public void testGetTypeInfo() {
    TypeLibUtil shellTypeLib = loadShellTypeLib();
    int typeInfoCount = shellTypeLib.getTypeInfoCount();
    for (int i = 0; i < typeInfoCount; i++) {
        ITypeInfo typeInfo = shellTypeLib.getTypeInfo(i);
        TypeInfoUtil typeInfoUtil = new TypeInfoUtil(typeInfo);
        TYPEATTR typeAttr = typeInfoUtil.getTypeAttr();
        int cFuncs = typeAttr.cFuncs.intValue();
        for (int y = 0; y < cFuncs; y++) {
            // Get the function description
            FUNCDESC funcDesc = typeInfoUtil.getFuncDesc(y);
            // Get the member ID
            MEMBERID memberID = funcDesc.memid;
            // Get the name of the method
            TypeInfoDoc typeInfoDoc2 = typeInfoUtil.getDocumentation(memberID);
            String methodName = typeInfoDoc2.getName();
            assertNotNull(methodName);
            typeInfoUtil.ReleaseFuncDesc(funcDesc);
        }
        typeInfoUtil.ReleaseTypeAttr(typeAttr);
    }
}
Also used : MEMBERID(com.sun.jna.platform.win32.OaIdl.MEMBERID) TypeInfoDoc(com.sun.jna.platform.win32.COM.TypeInfoUtil.TypeInfoDoc) TYPEATTR(com.sun.jna.platform.win32.OaIdl.TYPEATTR) FUNCDESC(com.sun.jna.platform.win32.OaIdl.FUNCDESC)

Example 2 with TypeInfoDoc

use of com.sun.jna.platform.win32.COM.TypeInfoUtil.TypeInfoDoc 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 3 with TypeInfoDoc

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

the class TypeInfoUtil method getDocumentation.

/**
     * Gets the documentation.
     * 
     * @param memid
     *            the memid
     * @return the documentation
     */
public TypeInfoDoc getDocumentation(MEMBERID memid) {
    BSTRByReference pBstrName = new BSTRByReference();
    BSTRByReference pBstrDocString = new BSTRByReference();
    DWORDByReference pdwHelpContext = new DWORDByReference();
    BSTRByReference pBstrHelpFile = new BSTRByReference();
    HRESULT hr = this.typeInfo.GetDocumentation(memid, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile);
    COMUtils.checkRC(hr);
    TypeInfoDoc TypeInfoDoc = new TypeInfoDoc(pBstrName.getString(), pBstrDocString.getString(), pdwHelpContext.getValue().intValue(), pBstrHelpFile.getString());
    OLEAUTO.SysFreeString(pBstrName.getValue());
    OLEAUTO.SysFreeString(pBstrDocString.getValue());
    OLEAUTO.SysFreeString(pBstrHelpFile.getValue());
    return TypeInfoDoc;
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) DWORDByReference(com.sun.jna.platform.win32.WinDef.DWORDByReference) BSTRByReference(com.sun.jna.platform.win32.WTypes.BSTRByReference)

Aggregations

TypeInfoDoc (com.sun.jna.platform.win32.COM.TypeInfoUtil.TypeInfoDoc)2 ITypeInfo (com.sun.jna.platform.win32.COM.ITypeInfo)1 TypeInfoUtil (com.sun.jna.platform.win32.COM.TypeInfoUtil)1 FUNCDESC (com.sun.jna.platform.win32.OaIdl.FUNCDESC)1 MEMBERID (com.sun.jna.platform.win32.OaIdl.MEMBERID)1 TYPEATTR (com.sun.jna.platform.win32.OaIdl.TYPEATTR)1 BSTRByReference (com.sun.jna.platform.win32.WTypes.BSTRByReference)1 DWORDByReference (com.sun.jna.platform.win32.WinDef.DWORDByReference)1 HRESULT (com.sun.jna.platform.win32.WinNT.HRESULT)1