use of com.sun.jna.platform.win32.OaIdl.MEMBERID 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;
}
use of com.sun.jna.platform.win32.OaIdl.MEMBERID in project jna by java-native-access.
the class TypeInfoUtil method getNames.
/**
* Gets the names.
*
* @param memid
* the memid
* @param maxNames
* the max names
* @return the names
*/
public String[] getNames(MEMBERID memid, int maxNames) {
BSTR[] rgBstrNames = new BSTR[maxNames];
UINTByReference pcNames = new UINTByReference();
HRESULT hr = this.typeInfo.GetNames(memid, rgBstrNames, new UINT(maxNames), pcNames);
COMUtils.checkRC(hr);
int cNames = pcNames.getValue().intValue();
String[] result = new String[cNames];
for (int i = 0; i < result.length; i++) {
result[i] = rgBstrNames[i].getValue();
OLEAUTO.SysFreeString(rgBstrNames[i]);
}
return result;
}
use of com.sun.jna.platform.win32.OaIdl.MEMBERID in project jna by java-native-access.
the class ITypeInfoTest method testAddressOfMember.
@Test
@Ignore("Needs a DLL that contains code")
public void testAddressOfMember() {
ITypeInfo[] typeInfos = getTypeInfos();
MEMBERID memid = new MEMBERID();
PointerByReference ppv = new PointerByReference();
for (ITypeInfo typeInfo : typeInfos) {
HRESULT hr = typeInfo.AddressOfMember(memid, INVOKEKIND.INVOKE_FUNC, ppv);
if (COMUtils.SUCCEEDED(hr)) {
//System.out.println("AddressOfMember: " + ppv.toString());
return;
}
}
throw new RuntimeException("Didn't find address for function in any of the type infos");
}
use of com.sun.jna.platform.win32.OaIdl.MEMBERID in project jna by java-native-access.
the class ITypeInfoTest method testGetNames.
@Test
public void testGetNames() {
ITypeInfo[] typeInfos = getTypeInfos();
MEMBERID memid = new MEMBERID(1);
BSTR[] rgBstrNames = new BSTR[1];
UINT cMaxNames = new UINT(1);
UINTByReference pcNames = new UINTByReference();
for (ITypeInfo typeInfo : typeInfos) {
HRESULT hr = typeInfo.GetNames(memid, rgBstrNames, cMaxNames, pcNames);
if (COMUtils.SUCCEEDED(hr)) {
//System.out.println("pcNames: " + pcNames.getValue().intValue());
return;
}
}
throw new RuntimeException("Didn't find name for member in any of the type infos");
}
use of com.sun.jna.platform.win32.OaIdl.MEMBERID 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());
}
Aggregations