use of com.sun.jna.platform.win32.WinNT.HRESULT in project jna by java-native-access.
the class ComEventCallbacks_Test method queryInterface_ConnectionPointContainer.
@Test
public void queryInterface_ConnectionPointContainer() {
Unknown unk = new Unknown(ieApp.getValue());
PointerByReference ppCpc = new PointerByReference();
HRESULT hr = unk.QueryInterface(new REFIID(IID_IConnectionPointContainer), ppCpc);
COMUtils.checkRC(hr);
// On success the returned pointer must not be null
Assert.assertNotNull(ppCpc.getPointer());
}
use of com.sun.jna.platform.win32.WinNT.HRESULT in project jna by java-native-access.
the class EnumMoniker_Test method Clone.
@Test
public void Clone() {
// GetRunningObjectTable
PointerByReference pprot = new PointerByReference();
HRESULT hr = Ole32.INSTANCE.GetRunningObjectTable(new DWORD(0), pprot);
COMUtils.checkRC(hr);
IRunningObjectTable rot = new RunningObjectTable(pprot.getValue());
// EnumRunning
PointerByReference ppenumMoniker = new PointerByReference();
hr = rot.EnumRunning(ppenumMoniker);
COMUtils.checkRC(hr);
IEnumMoniker iterator1 = new EnumMoniker(ppenumMoniker.getValue());
// iterator1.Reset
hr = iterator1.Reset();
COMUtils.checkRC(hr);
// iterator1.Next
PointerByReference rgelt1 = new PointerByReference();
ULONGByReference pceltFetched1 = new ULONGByReference();
hr = iterator1.Next(new ULONG(1), rgelt1, pceltFetched1);
COMUtils.checkRC(hr);
// iterator1.Clone
PointerByReference ppenum = new PointerByReference();
hr = iterator1.Clone(ppenum);
COMUtils.checkRC(hr);
IEnumMoniker iterator2 = new EnumMoniker(ppenum.getValue());
// iterator2.Next
PointerByReference rgelt2 = new PointerByReference();
ULONGByReference pceltFetched2 = new ULONGByReference();
hr = iterator2.Next(new ULONG(1), rgelt2, pceltFetched2);
COMUtils.checkRC(hr);
assertNotEquals(rgelt1.getValue(), rgelt2.getValue());
// iterator1.Next
rgelt1 = new PointerByReference();
pceltFetched1 = new ULONGByReference();
hr = iterator1.Next(new ULONG(1), rgelt1, pceltFetched1);
COMUtils.checkRC(hr);
assertEquals(rgelt1.getValue(), rgelt2.getValue());
}
use of com.sun.jna.platform.win32.WinNT.HRESULT in project jna by java-native-access.
the class EnumMoniker_Test method Next.
@Test
public void Next() {
// GetRunningObjectTable
PointerByReference pprot = new PointerByReference();
HRESULT hr = Ole32.INSTANCE.GetRunningObjectTable(new DWORD(0), pprot);
COMUtils.checkRC(hr);
IRunningObjectTable rot = new RunningObjectTable(pprot.getValue());
// EnumRunning
PointerByReference ppenumMoniker = new PointerByReference();
hr = rot.EnumRunning(ppenumMoniker);
COMUtils.checkRC(hr);
IEnumMoniker iterator = new EnumMoniker(ppenumMoniker.getValue());
// Reset
hr = iterator.Reset();
COMUtils.checkRC(hr);
// Next
PointerByReference rgelt1 = new PointerByReference();
ULONGByReference pceltFetched1 = new ULONGByReference();
hr = iterator.Next(new ULONG(1), rgelt1, pceltFetched1);
COMUtils.checkRC(hr);
// Next
PointerByReference rgelt2 = new PointerByReference();
ULONGByReference pceltFetched2 = new ULONGByReference();
hr = iterator.Next(new ULONG(1), rgelt2, pceltFetched2);
COMUtils.checkRC(hr);
assertNotEquals(rgelt1.getValue(), rgelt2.getValue());
}
use of com.sun.jna.platform.win32.WinNT.HRESULT in project jna by java-native-access.
the class EnumMoniker_Test method Reset.
@Test
public void Reset() {
// GetRunningObjectTable
PointerByReference pprot = new PointerByReference();
HRESULT hr = Ole32.INSTANCE.GetRunningObjectTable(new DWORD(0), pprot);
COMUtils.checkRC(hr);
IRunningObjectTable rot = new RunningObjectTable(pprot.getValue());
// EnumRunning
PointerByReference ppenumMoniker = new PointerByReference();
hr = rot.EnumRunning(ppenumMoniker);
COMUtils.checkRC(hr);
IEnumMoniker iterator = new EnumMoniker(ppenumMoniker.getValue());
// Reset
hr = iterator.Reset();
COMUtils.checkRC(hr);
// Next
PointerByReference rgelt1 = new PointerByReference();
ULONGByReference pceltFetched1 = new ULONGByReference();
hr = iterator.Next(new ULONG(1), rgelt1, pceltFetched1);
COMUtils.checkRC(hr);
// Reset
hr = iterator.Reset();
COMUtils.checkRC(hr);
// Next
PointerByReference rgelt2 = new PointerByReference();
ULONGByReference pceltFetched2 = new ULONGByReference();
hr = iterator.Next(new ULONG(1), rgelt2, pceltFetched2);
COMUtils.checkRC(hr);
assertEquals(rgelt1.getValue(), rgelt2.getValue());
}
use of com.sun.jna.platform.win32.WinNT.HRESULT in project jna by java-native-access.
the class IDispatchTest method testGetTypeInfo.
public void testGetTypeInfo() {
Dispatch dispatch = this.createIDispatch();
PointerByReference ppTInfo = new PointerByReference();
HRESULT hr = dispatch.GetTypeInfo(new UINT(0), LOCALE_SYSTEM_DEFAULT, ppTInfo);
COMUtils.checkRC(hr);
assertEquals(0, hr.intValue());
}
Aggregations