Search in sources :

Example 1 with FUNCDESC

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

use of com.sun.jna.platform.win32.OaIdl.FUNCDESC in project jna by java-native-access.

the class TypeInfoUtil method getFuncDesc.

/**
     * Gets the func desc.
     * 
     * @param index
     *            the index
     * @return the func desc
     */
public FUNCDESC getFuncDesc(int index) {
    PointerByReference ppFuncDesc = new PointerByReference();
    HRESULT hr = this.typeInfo.GetFuncDesc(new UINT(index), ppFuncDesc);
    COMUtils.checkRC(hr);
    return new FUNCDESC(ppFuncDesc.getValue());
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) PointerByReference(com.sun.jna.ptr.PointerByReference) FUNCDESC(com.sun.jna.platform.win32.OaIdl.FUNCDESC) UINT(com.sun.jna.platform.win32.WinDef.UINT)

Example 3 with FUNCDESC

use of com.sun.jna.platform.win32.OaIdl.FUNCDESC in project jna by java-native-access.

the class TlbCoClass method createFunctions.

protected void createFunctions(TypeInfoUtil typeInfoUtil, String bindingMode) {
    TYPEATTR typeAttr = typeInfoUtil.getTypeAttr();
    int cFuncs = typeAttr.cFuncs.intValue();
    for (int i = 0; i < cFuncs; i++) {
        // Get the function description
        FUNCDESC funcDesc = typeInfoUtil.getFuncDesc(i);
        TlbAbstractMethod method = null;
        if (funcDesc.invkind.value == INVOKEKIND.INVOKE_FUNC.value) {
            if (this.isVTableMode()) {
                method = new TlbFunctionVTable(i, index, typeLibUtil, funcDesc, typeInfoUtil);
            } else {
                method = new TlbFunctionDispId(i, index, typeLibUtil, funcDesc, typeInfoUtil);
            }
        } else if (funcDesc.invkind.value == INVOKEKIND.INVOKE_PROPERTYGET.value) {
            method = new TlbPropertyGet(i, index, typeLibUtil, funcDesc, typeInfoUtil);
        } else if (funcDesc.invkind.value == INVOKEKIND.INVOKE_PROPERTYPUT.value) {
            method = new TlbPropertyPut(i, index, typeLibUtil, funcDesc, typeInfoUtil);
        } else if (funcDesc.invkind.value == INVOKEKIND.INVOKE_PROPERTYPUTREF.value) {
            method = new TlbPropertyPut(i, index, typeLibUtil, funcDesc, typeInfoUtil);
        }
        if (!isReservedMethod(method.getMethodName())) {
            this.content += method.getClassBuffer();
            if (i < cFuncs - 1)
                this.content += CR;
        }
        // Release our function description stuff
        typeInfoUtil.ReleaseFuncDesc(funcDesc);
    }
}
Also used : TYPEATTR(com.sun.jna.platform.win32.OaIdl.TYPEATTR) FUNCDESC(com.sun.jna.platform.win32.OaIdl.FUNCDESC)

Aggregations

FUNCDESC (com.sun.jna.platform.win32.OaIdl.FUNCDESC)3 TYPEATTR (com.sun.jna.platform.win32.OaIdl.TYPEATTR)2 TypeInfoDoc (com.sun.jna.platform.win32.COM.TypeInfoUtil.TypeInfoDoc)1 MEMBERID (com.sun.jna.platform.win32.OaIdl.MEMBERID)1 UINT (com.sun.jna.platform.win32.WinDef.UINT)1 HRESULT (com.sun.jna.platform.win32.WinNT.HRESULT)1 PointerByReference (com.sun.jna.ptr.PointerByReference)1