Search in sources :

Example 1 with TYPEATTR

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

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

Example 3 with TYPEATTR

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

the class TypeInfoUtil method getTypeAttr.

/**
     * Gets the type attr.
     * 
     * @return the type attr
     */
public TYPEATTR getTypeAttr() {
    PointerByReference ppTypeAttr = new PointerByReference();
    HRESULT hr = this.typeInfo.GetTypeAttr(ppTypeAttr);
    COMUtils.checkRC(hr);
    return new TYPEATTR(ppTypeAttr.getValue());
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) PointerByReference(com.sun.jna.ptr.PointerByReference) TYPEATTR(com.sun.jna.platform.win32.OaIdl.TYPEATTR)

Example 4 with TYPEATTR

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

the class COMTest method testTYPEATTR.

public void testTYPEATTR() {
    int pSize = Native.POINTER_SIZE;
    TYPEATTR typeAttr = new TYPEATTR();
    typeAttr.guid = GUID.fromString("{50A7E9B0-70EF-11D1-B75A-00A0C90564FE}");
    typeAttr.lcid = Kernel32.INSTANCE.GetSystemDefaultLCID();
    typeAttr.dwReserved = new DWORD(1);
    typeAttr.memidConstructor = new MEMBERID(2);
    typeAttr.memidDestructor = new MEMBERID(3);
    typeAttr.lpstrSchema = new LPOLESTR("Hello World");
    typeAttr.cbSizeInstance = new ULONG(4);
    typeAttr.typekind = new TYPEKIND(5);
    typeAttr.cFuncs = new WORD(6);
    typeAttr.cVars = new WORD(7);
    typeAttr.cImplTypes = new WORD(8);
    typeAttr.cbSizeVft = new WORD(9);
    typeAttr.cbAlignment = new WORD(10);
    typeAttr.wMajorVerNum = new WORD(11);
    typeAttr.wMinorVerNum = new WORD(12);
    typeAttr.tdescAlias = new TYPEDESC();
    typeAttr.idldescType = new IDLDESC();
    typeAttr.write();
    typeAttr.read();
//System.out.println(typeAttr.toString());
//System.out.println("TYPEATTR size: " + typeAttr.size());
}
Also used : ULONG(com.sun.jna.platform.win32.WinDef.ULONG) DWORD(com.sun.jna.platform.win32.WinDef.DWORD) WORD(com.sun.jna.platform.win32.WinDef.WORD) MEMBERID(com.sun.jna.platform.win32.OaIdl.MEMBERID) TYPEDESC(com.sun.jna.platform.win32.OaIdl.TYPEDESC) TYPEATTR(com.sun.jna.platform.win32.OaIdl.TYPEATTR) LPOLESTR(com.sun.jna.platform.win32.WTypes.LPOLESTR) DWORD(com.sun.jna.platform.win32.WinDef.DWORD) IDLDESC(com.sun.jna.platform.win32.OaIdl.IDLDESC) TYPEKIND(com.sun.jna.platform.win32.OaIdl.TYPEKIND)

Aggregations

TYPEATTR (com.sun.jna.platform.win32.OaIdl.TYPEATTR)4 FUNCDESC (com.sun.jna.platform.win32.OaIdl.FUNCDESC)2 MEMBERID (com.sun.jna.platform.win32.OaIdl.MEMBERID)2 TypeInfoDoc (com.sun.jna.platform.win32.COM.TypeInfoUtil.TypeInfoDoc)1 IDLDESC (com.sun.jna.platform.win32.OaIdl.IDLDESC)1 TYPEDESC (com.sun.jna.platform.win32.OaIdl.TYPEDESC)1 TYPEKIND (com.sun.jna.platform.win32.OaIdl.TYPEKIND)1 LPOLESTR (com.sun.jna.platform.win32.WTypes.LPOLESTR)1 DWORD (com.sun.jna.platform.win32.WinDef.DWORD)1 ULONG (com.sun.jna.platform.win32.WinDef.ULONG)1 WORD (com.sun.jna.platform.win32.WinDef.WORD)1 HRESULT (com.sun.jna.platform.win32.WinNT.HRESULT)1 PointerByReference (com.sun.jna.ptr.PointerByReference)1