Search in sources :

Example 21 with HRESULT

use of com.sun.jna.platform.win32.WinNT.HRESULT in project jna by java-native-access.

the class RunningObjectTable_Test method Revoke.

@Test
public void Revoke() {
    PointerByReference pprot = new PointerByReference();
    HRESULT hr = Ole32.INSTANCE.GetRunningObjectTable(new DWORD(0), pprot);
    COMUtils.checkRC(hr);
    IRunningObjectTable rot = new RunningObjectTable(pprot.getValue());
//Can't yet be tested as IMoniker is not fully implemented,
// so we can't register an object, and hence can't get a registration key to Revoke one
//rot.Revoke(dwRegister);
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) PointerByReference(com.sun.jna.ptr.PointerByReference) DWORD(com.sun.jna.platform.win32.WinDef.DWORD) Test(org.junit.Test)

Example 22 with HRESULT

use of com.sun.jna.platform.win32.WinNT.HRESULT in project jna by java-native-access.

the class RunningObjectTable_Test method before.

@Before
public void before() {
    HRESULT hr = Ole32.INSTANCE.CoInitialize(null);
    COMUtils.checkRC(hr);
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) Before(org.junit.Before)

Example 23 with HRESULT

use of com.sun.jna.platform.win32.WinNT.HRESULT in project jna by java-native-access.

the class Shell32Test method testCurrentProcessExplicitAppUserModelID.

public void testCurrentProcessExplicitAppUserModelID() {
    String appUserModelID = "com.sun.jna.platform.win32.Shell32Test";
    HRESULT r1 = Shell32.INSTANCE.SetCurrentProcessExplicitAppUserModelID(new WString(appUserModelID));
    assertEquals(WinError.S_OK, r1);
    PointerByReference ppszAppID = new PointerByReference();
    HRESULT r2 = Shell32.INSTANCE.GetCurrentProcessExplicitAppUserModelID(ppszAppID);
    assertEquals(WinError.S_OK, r2);
    assertEquals(appUserModelID, ppszAppID.getValue().getWideString(0));
    Ole32.INSTANCE.CoTaskMemFree(ppszAppID.getValue());
}
Also used : WString(com.sun.jna.WString) HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) PointerByReference(com.sun.jna.ptr.PointerByReference) WString(com.sun.jna.WString)

Example 24 with HRESULT

use of com.sun.jna.platform.win32.WinNT.HRESULT in project jna by java-native-access.

the class VariantTest method testVariantClear.

public void testVariantClear() {
    VARIANT variant = new VARIANT(new SHORT(33333));
    HRESULT hr = OleAuto.INSTANCE.VariantClear(variant);
    assertTrue("hr: " + hr.intValue(), hr.intValue() == 0);
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) VARIANT(com.sun.jna.platform.win32.Variant.VARIANT) SHORT(com.sun.jna.platform.win32.WinDef.SHORT) USHORT(com.sun.jna.platform.win32.WinDef.USHORT)

Example 25 with HRESULT

use of com.sun.jna.platform.win32.WinNT.HRESULT in project jna by java-native-access.

the class VariantTest method testVariantCopyShort.

public void testVariantCopyShort() {
    VARIANT variantSource = new VARIANT(new SHORT(33333));
    VARIANT variantDest = new VARIANT();
    //System.out.println(variantSource.toString(true));
    HRESULT hr = OleAuto.INSTANCE.VariantCopy(variantDest.getPointer(), variantSource);
    assertTrue("hr: " + hr.intValue(), hr.intValue() == 0);
}
Also used : HRESULT(com.sun.jna.platform.win32.WinNT.HRESULT) VARIANT(com.sun.jna.platform.win32.Variant.VARIANT) SHORT(com.sun.jna.platform.win32.WinDef.SHORT) USHORT(com.sun.jna.platform.win32.WinDef.USHORT)

Aggregations

HRESULT (com.sun.jna.platform.win32.WinNT.HRESULT)102 PointerByReference (com.sun.jna.ptr.PointerByReference)57 Test (org.junit.Test)26 REFIID (com.sun.jna.platform.win32.Guid.REFIID)20 UINT (com.sun.jna.platform.win32.WinDef.UINT)15 WString (com.sun.jna.WString)12 DWORD (com.sun.jna.platform.win32.WinDef.DWORD)12 WinNT (com.sun.jna.platform.win32.WinNT)12 DWORDByReference (com.sun.jna.platform.win32.WinDef.DWORDByReference)11 VARIANT (com.sun.jna.platform.win32.Variant.VARIANT)10 MEMBERID (com.sun.jna.platform.win32.OaIdl.MEMBERID)9 BSTRByReference (com.sun.jna.platform.win32.WTypes.BSTRByReference)9 ULONG (com.sun.jna.platform.win32.WinDef.ULONG)9 IID (com.sun.jna.platform.win32.Guid.IID)8 DISPIDByReference (com.sun.jna.platform.win32.OaIdl.DISPIDByReference)8 IntByReference (com.sun.jna.ptr.IntByReference)8 UINTByReference (com.sun.jna.platform.win32.WinDef.UINTByReference)7 COMException (com.sun.jna.platform.win32.COM.COMException)6 ConnectionPoint (com.sun.jna.platform.win32.COM.ConnectionPoint)6 Pointer (com.sun.jna.Pointer)5