Package com.sun.jna.platform.win32

Examples of com.sun.jna.platform.win32.WinUser$MSG


    assertEquals("{00000000-0000-0000-0000-000000000000}",
        Native.toString(lpsz));
  }

  public void testCoInitializeEx() {
    HRESULT hr = Ole32.INSTANCE.CoInitializeEx(null, 0);
    assertTrue(W32Errors.SUCCEEDED(hr.intValue())
        || hr.intValue() == W32Errors.RPC_E_CHANGED_MODE);
    if (W32Errors.SUCCEEDED(hr.intValue()))
      Ole32.INSTANCE.CoUninitialize();
  }
View Full Code Here


    if (W32Errors.SUCCEEDED(hr.intValue()))
      Ole32.INSTANCE.CoUninitialize();
  }

  public void testCoCreateInstance() {
    HRESULT hrCI = Ole32.INSTANCE.CoInitializeEx(null, 0);

    GUID guid = Ole32Util
        .getGUIDFromString("{00021401-0000-0000-C000-000000000046}"); // Shell object
    GUID riid = Ole32Util
        .getGUIDFromString("{000214EE-0000-0000-C000-000000000046}"); // IShellLinkA

    PointerByReference pDispatch = new PointerByReference();

    HRESULT hr = Ole32.INSTANCE.CoCreateInstance(guid, null, // pOuter =
                                  // null, no
                                  // aggregation
        WTypes.CLSCTX_LOCAL_SERVER, riid, pDispatch);
    assertTrue(W32Errors.SUCCEEDED(hr.intValue()));
    assertTrue(!pDispatch.equals(Pointer.NULL));
    // We leak this iUnknown reference because we don't have the JNACOM lib
    // here to wrap the native iUnknown pointer and call iUnknown.release()
    if (W32Errors.SUCCEEDED(hrCI.intValue()))
      Ole32.INSTANCE.CoUninitialize();
View Full Code Here

   * @return
   *  A GUID.
   */
  public static GUID getGUIDFromString(String guidString) {
    GUID lpiid = new GUID();
      HRESULT hr = Ole32.INSTANCE.IIDFromString(guidString, lpiid);
      if (! hr.equals(W32Errors.S_OK)) {
        throw new RuntimeException(hr.toString());
      }
      return lpiid;
  }
View Full Code Here

   * @return
   *  New GUID.
   */
  public static GUID generateGUID() {
    GUID pguid = new GUID();
      HRESULT hr = Ole32.INSTANCE.CoCreateGuid(pguid);
      if (! hr.equals(W32Errors.S_OK)) {
        throw new RuntimeException(hr.toString());
      }
      return pguid;
  }
View Full Code Here

                null, 1, null, 0, pcbNeeded, pcReturned);
        if (pcbNeeded.getValue() <= 0) {
            return new PRINTER_INFO_1[0];
        }

        PRINTER_INFO_1 pPrinterEnum = new PRINTER_INFO_1(pcbNeeded.getValue());
        if (!Winspool.INSTANCE.EnumPrinters(Winspool.PRINTER_ENUM_LOCAL,
                null, 1, pPrinterEnum.getPointer(), pcbNeeded.getValue(), pcbNeeded, pcReturned)) {
            throw new Win32Exception(Kernel32.INSTANCE.GetLastError());
        }

        pPrinterEnum.read();

        return (PRINTER_INFO_1[]) pPrinterEnum.toArray(pcReturned.getValue());
    }
View Full Code Here

                null, 4, null, 0, pcbNeeded, pcReturned);
        if (pcbNeeded.getValue() <= 0) {
            return new PRINTER_INFO_4[0];
        }

        PRINTER_INFO_4 pPrinterEnum = new PRINTER_INFO_4(pcbNeeded.getValue());
        if (!Winspool.INSTANCE.EnumPrinters(Winspool.PRINTER_ENUM_LOCAL,
                null, 4, pPrinterEnum.getPointer(), pcbNeeded.getValue(), pcbNeeded, pcReturned)) {
            throw new Win32Exception(Kernel32.INSTANCE.GetLastError());
        }

        pPrinterEnum.read();

        return (PRINTER_INFO_4[]) pPrinterEnum.toArray(pcReturned.getValue());
    }
View Full Code Here

        SWT.error(SWT.ERROR_NO_MORE_CALLBACKS);
      int threadId = Extension.GetCurrentThreadId();
      procHandle = Extension.SetWindowsHookEx(Extension.WH_GETMESSAGE,
          oleMsgProcAddress, 0, threadId);
      Display.getDefault().setData(HHOOK, new LONG(procHandle));
      Display.getDefault().setData(HHOOKMSG, new MSG());
    }
  }
View Full Code Here

      return 0;
    if (code < 0) {
      return OS.CallNextHookEx(hHook.value, (int) /* 64 */code, wParam,
          lParam);
    }
    MSG msg = (MSG) Display.getDefault().getData(HHOOKMSG);
    OS.MoveMemory(msg, lParam, MSG.sizeof);
    if (!container.isDisposed()) {
      if (container.getHookInterceptor() != null) {
        Msg message = new Msg(msg);
        if (container.getHookInterceptor().intercept(message, code,
View Full Code Here

   * @param point
   *            a memory MSG struct point
   * @return An MSG object.
   */
  public static Msg valueOf(int point) {
    MSG msg = new MSG();
    Extension.MoveMemory(msg, point, MSG.sizeof);
    return new Msg(msg);
  }
View Full Code Here

        _hWnd = MyUser32.INSTANCE.CreateWindowExA(0, _wndClass.lpszClassName, _wndClass.lpszClassName, 0, 0, 0, 0, 0, null, null, _hinstance,
            null);
        MyUser32.INSTANCE.ShowWindow(_hWnd, MyUser32.SW_HIDE);
        MyUser32.INSTANCE.UpdateWindow(_hWnd);

        MSG msg = new MSG();
        msg.size();
        int ret;
        do
        {
          ret = MyUser32.INSTANCE.GetMessageA(msg, _hWnd, 0, 0);
          // System.out.println("get message "+msg);
View Full Code Here

TOP

Related Classes of com.sun.jna.platform.win32.WinUser$MSG

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.