Search in sources :

Example 16 with MEMBERID

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

the class ITypeInfoTest method testGetIDsOfNames.

@Test
public void testGetIDsOfNames() {
    ITypeInfo[] typeInfos = getTypeInfos();
    LPOLESTR[] rgszNames = { new LPOLESTR("Help") };
    UINT cNames = new UINT(1);
    MEMBERID[] pMemId = new MEMBERID[1];
    for (ITypeInfo typeInfo : typeInfos) {
        HRESULT hr = typeInfo.GetIDsOfNames(rgszNames, cNames, pMemId);
        if (COMUtils.SUCCEEDED(hr)) {
            //System.out.println("pMemId: " + pMemId.toString());
            return;
        }
    }
    throw new RuntimeException("Didn't find Help in any of the type infos");
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) MEMBERID(com.sun.jna.platform.win32.OaIdl.MEMBERID) LPOLESTR(com.sun.jna.platform.win32.WTypes.LPOLESTR) UINT(com.sun.jna.platform.win32.WinDef.UINT) Test(org.junit.Test)

Example 17 with MEMBERID

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

the class ITypeInfoTest method testGetDllEntry.

@Test
@Ignore("Needs a DLL that contains code")
public void testGetDllEntry() {
    ITypeInfo[] typeInfos = getTypeInfos();
    MEMBERID memid = new MEMBERID(0);
    BSTRByReference pBstrDllName = new BSTRByReference();
    BSTRByReference pBstrName = new BSTRByReference();
    WORDByReference pwOrdinal = new WORDByReference();
    for (ITypeInfo typeInfo : typeInfos) {
        HRESULT hr = typeInfo.GetDllEntry(memid, INVOKEKIND.INVOKE_FUNC, pBstrDllName, pBstrName, pwOrdinal);
        if (COMUtils.SUCCEEDED(hr)) {
            //System.out.println("pwOrdinal: " + pwOrdinal.getValue());
            return;
        }
    }
    throw new RuntimeException("Didn't find Dll entry for member in any of the type infos");
}
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) DWORDByReference(com.sun.jna.platform.win32.WinDef.DWORDByReference) WORDByReference(com.sun.jna.platform.win32.WinDef.WORDByReference) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

HRESULT (com.sun.jna.platform.win32.WinNT.HRESULT)15 MEMBERID (com.sun.jna.platform.win32.OaIdl.MEMBERID)11 BSTRByReference (com.sun.jna.platform.win32.WTypes.BSTRByReference)7 Test (org.junit.Test)6 DWORDByReference (com.sun.jna.platform.win32.WinDef.DWORDByReference)5 UINT (com.sun.jna.platform.win32.WinDef.UINT)4 PointerByReference (com.sun.jna.ptr.PointerByReference)4 LPOLESTR (com.sun.jna.platform.win32.WTypes.LPOLESTR)3 UINTByReference (com.sun.jna.platform.win32.WinDef.UINTByReference)3 ULONG (com.sun.jna.platform.win32.WinDef.ULONG)3 WORDByReference (com.sun.jna.platform.win32.WinDef.WORDByReference)3 Pointer (com.sun.jna.Pointer)2 TYPEATTR (com.sun.jna.platform.win32.OaIdl.TYPEATTR)2 WTypes (com.sun.jna.platform.win32.WTypes)2 BSTR (com.sun.jna.platform.win32.WTypes.BSTR)2 USHORTByReference (com.sun.jna.platform.win32.WinDef.USHORTByReference)2 Ignore (org.junit.Ignore)2 WString (com.sun.jna.WString)1 TypeInfoDoc (com.sun.jna.platform.win32.COM.TypeInfoUtil.TypeInfoDoc)1 OaIdl (com.sun.jna.platform.win32.OaIdl)1