Search in sources :

Example 1 with ITypeInfo

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

the class ITypeInfoTest method testGetMops.

@Test
public void testGetMops() {
    ITypeInfo typeInfo = getTypeInfo();
    MEMBERID memid = new MEMBERID(0);
    BSTRByReference pBstrMops = new BSTRByReference();
    HRESULT hr = typeInfo.GetMops(memid, pBstrMops);
    COMUtils.checkRC(hr);
    assertEquals(0, hr.intValue());
//System.out.println("pBstrMops: " + pBstrMops.toString());
}
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) Test(org.junit.Test)

Example 2 with ITypeInfo

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

the class ITypeInfoTest method testGetImplTypeFlags.

@Test
public void testGetImplTypeFlags() {
    ITypeInfo typeInfo = getTypeInfo();
    IntByReference pImplTypeFlags = new IntByReference();
    HRESULT hr = typeInfo.GetImplTypeFlags(new UINT(0), pImplTypeFlags);
    COMUtils.checkRC(hr);
    assertEquals(0, hr.intValue());
//System.out.println("GetImplTypeFlags: " + pImplTypeFlags.toString());
}
Also used : IntByReference(com.sun.jna.ptr.IntByReference) HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) UINT(com.sun.jna.platform.win32.WinDef.UINT) Test(org.junit.Test)

Example 3 with ITypeInfo

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

the class ITypeLibTest method testGetTypeInfo.

public void testGetTypeInfo() {
    ITypeLib shellTypeLib = loadShellTypeLib();
    PointerByReference ppTInfo = new PointerByReference();
    HRESULT hr = shellTypeLib.GetTypeInfo(new UINT(0), ppTInfo);
    assertTrue(COMUtils.SUCCEEDED(hr));
//System.out.println("ITypeInfo: " + ppTInfo.toString());
}
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 4 with ITypeInfo

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

the class TypeLibUtilTest method testFindName.

public void testFindName() {
    // Test is modelled after ITypeLibTest#testFindName
    TypeLibUtil shellTypeLib = loadShellTypeLib();
    String memberValue = "count";
    String memberValueOk = "Count";
    FindName result = shellTypeLib.FindName(memberValue, 0, (short) 100);
    // 2 matches come from manual tests
    assertEquals(2, result.getFound());
    // Check that function return corrected member name (Count) - see uppercase C
    assertEquals(memberValueOk, result.getNameBuf());
    // There have to be as many pointers as reported by pcFound
    ITypeInfo[] typelib = result.getTInfo();
    assertEquals(2, typelib.length);
    assertNotNull(typelib[0]);
    assertNotNull(typelib[1]);
    PointerByReference pbr = new PointerByReference();
    HRESULT hr = typelib[1].GetTypeAttr(pbr);
    assertTrue(COMUtils.SUCCEEDED(hr));
    OaIdl.TYPEATTR pTypeAttr = new OaIdl.TYPEATTR(pbr.getValue());
    // Either interface FolderItemVerbs ({1F8352C0-50B0-11CF-960C-0080C7F4EE85})
    // or FolderItems ({744129E0-CBE5-11CE-8350-444553540000})
    String typeGUID = pTypeAttr.guid.toGuidString();
    assertTrue(typeGUID.equals("{1F8352C0-50B0-11CF-960C-0080C7F4EE85}") || typeGUID.equals("{744129E0-CBE5-11CE-8350-444553540000}"));
    typelib[1].ReleaseTypeAttr(pTypeAttr);
}
Also used : TYPEATTR(com.sun.jna.platform.win32.OaIdl.TYPEATTR) HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) PointerByReference(com.sun.jna.ptr.PointerByReference) TYPEATTR(com.sun.jna.platform.win32.OaIdl.TYPEATTR) OaIdl(com.sun.jna.platform.win32.OaIdl) FindName(com.sun.jna.platform.win32.COM.TypeLibUtil.FindName)

Example 5 with ITypeInfo

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

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