Search in sources :

Example 1 with LPOLESTR

use of com.sun.jna.platform.win32.WTypes.LPOLESTR in project jna by java-native-access.

the class TypeLibUtil method IsName.

/**
     * Checks if is name.
     * 
     * @param nameBuf
     *            the name buf
     * @param hashVal
     *            the hash val
     * @return the checks if is name
     */
public IsName IsName(String nameBuf, int hashVal) {
    LPOLESTR szNameBuf = new LPOLESTR(nameBuf);
    ULONG lHashVal = new ULONG(hashVal);
    BOOLByReference pfName = new BOOLByReference();
    HRESULT hr = this.typelib.IsName(szNameBuf, lHashVal, pfName);
    COMUtils.checkRC(hr);
    return new IsName(szNameBuf.getValue(), pfName.getValue().booleanValue());
}
Also used : ULONG(com.sun.jna.platform.win32.WinDef.ULONG) BOOLByReference(com.sun.jna.platform.win32.WinDef.BOOLByReference) HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) LPOLESTR(com.sun.jna.platform.win32.WTypes.LPOLESTR)

Example 2 with LPOLESTR

use of com.sun.jna.platform.win32.WTypes.LPOLESTR in project jna by java-native-access.

the class TypeInfoUtil method getIDsOfNames.

/**
     * Gets the i ds of names.
     * 
     * @param rgszNames
     *            the rgsz names
     * @param cNames
     *            the c names
     * @return the i ds of names
     */
public MEMBERID[] getIDsOfNames(LPOLESTR[] rgszNames, int cNames) {
    MEMBERID[] pMemId = new MEMBERID[cNames];
    HRESULT hr = this.typeInfo.GetIDsOfNames(rgszNames, new UINT(cNames), pMemId);
    COMUtils.checkRC(hr);
    return pMemId;
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) MEMBERID(com.sun.jna.platform.win32.OaIdl.MEMBERID) UINT(com.sun.jna.platform.win32.WinDef.UINT)

Example 3 with LPOLESTR

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

Example 4 with LPOLESTR

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

Aggregations

MEMBERID (com.sun.jna.platform.win32.OaIdl.MEMBERID)3 LPOLESTR (com.sun.jna.platform.win32.WTypes.LPOLESTR)3 HRESULT (com.sun.jna.platform.win32.WinNT.HRESULT)3 UINT (com.sun.jna.platform.win32.WinDef.UINT)2 ULONG (com.sun.jna.platform.win32.WinDef.ULONG)2 IDLDESC (com.sun.jna.platform.win32.OaIdl.IDLDESC)1 TYPEATTR (com.sun.jna.platform.win32.OaIdl.TYPEATTR)1 TYPEDESC (com.sun.jna.platform.win32.OaIdl.TYPEDESC)1 TYPEKIND (com.sun.jna.platform.win32.OaIdl.TYPEKIND)1 BOOLByReference (com.sun.jna.platform.win32.WinDef.BOOLByReference)1 DWORD (com.sun.jna.platform.win32.WinDef.DWORD)1 WORD (com.sun.jna.platform.win32.WinDef.WORD)1 Test (org.junit.Test)1