Java 类org.eclipse.swt.internal.win32.OS 实例源码

项目:Black    文件:EmbedEXEIntoSWT.java   
private boolean executeProg(String fileName) throws Exception  
{  
    int hHeap = OS.GetProcessHeap ();  
    TCHAR buffer = new TCHAR (0, fileName, true);  
    int byteCount = buffer.length () * TCHAR.sizeof;  
    int lpFile = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);  
    OS.MoveMemory (lpFile, buffer, byteCount);  
    SHELLEXECUTEINFO info = new SHELLEXECUTEINFO ();  
    info.cbSize = SHELLEXECUTEINFO.sizeof;  
    info.lpFile = lpFile;  
    //��������  
    info.nShow = OS.SW_HIDE;  
    boolean result = OS.ShellExecuteEx (info);  
    if (lpFile != 0) OS.HeapFree (hHeap, 0, lpFile);  
    return result;  
}
项目:JXTN    文件:FXCanvas2.java   
@SuppressWarnings("deprecation")
private void updateImeCandicatePos()
{
    EmbeddedSceneInterface emScene = (EmbeddedSceneInterface) this.getScene().impl_getPeer();
    InputMethodRequests imeRequests = emScene.getInputMethodRequests();
    Point2D absolutePos = imeRequests.getTextLocation(0);
    COMPOSITIONFORM lpCompForm = new COMPOSITIONFORM();
    lpCompForm.dwStyle = OS.CFS_CANDIDATEPOS;
    Point relativePos = this.toControl((int) absolutePos.getX(), (int) absolutePos.getY());
    lpCompForm.x = relativePos.x;
    lpCompForm.y = relativePos.y;
    long hIMC = OS.ImmGetContext(this.handle);
    try
    {
        OS.ImmSetCompositionWindow(hIMC, lpCompForm);
    }
    finally
    {
        OS.ImmReleaseContext(this.handle, hIMC);
    }
}
项目:lwjgl3-swt    文件:PlatformWin32VKCanvas.java   
public int checkStyle(Composite parent, int style) {
    // Somehow we need to temporarily set 'org.eclipse.swt.internal.win32.useOwnDC' to true or else context creation on Windows fails...
    if (parent != null) {
        if (!org.eclipse.swt.internal.win32.OS.IsWinCE
                && org.eclipse.swt.internal.win32.OS.WIN32_VERSION >= org.eclipse.swt.internal.win32.OS.VERSION(6, 0)) {
            parent.getDisplay().setData(USE_OWNDC_KEY, Boolean.TRUE);
        }
    }
    return style;
}
项目:lwjgl3-swt    文件:PlatformWin32VKCanvas.java   
@Override
public long create(Composite composite, VKData data) {
    VkWin32SurfaceCreateInfoKHR sci = VkWin32SurfaceCreateInfoKHR.callocStack()
      .sType(VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR)
      .hinstance(OS.GetModuleHandle(null))
      .hwnd(composite.handle);
    LongBuffer pSurface = stackMallocLong(1);
    int err = vkCreateWin32SurfaceKHR(data.instance, sci, null, pSurface);
    long surface = pSurface.get(0);
    if (err != VK_SUCCESS) {
        throw new SWTException("Calling vkCreateWin32SurfaceKHR failed with error: " + err);
    }
    return surface;
}
项目:p2-installer    文件:Win32ActionsProvider.java   
@Override
public void bringToFront(Shell shell) {
    /**
     * SWT doesn't provide a direct means to bring the shell to the front on 
     * all Windows versions.  <code>Shell.forceActive</code> will not on 
     * more modern versions of Windows.  This method uses the workaround 
     * given in:
     * https://bugs.eclipse.org/bugs/show_bug.cgi?id=192036
     */
    int hFrom = OS.GetForegroundWindow();

    if (hFrom <= 0) {
        OS.SetForegroundWindow(shell.handle);
        return;
    }
    if (shell.handle == hFrom) {
        return;
    }
    int pid = OS.GetWindowThreadProcessId(hFrom, null);
    int _threadid = OS.GetWindowThreadProcessId(shell.handle, null);

    if (_threadid == pid) {
      OS.SetForegroundWindow(shell.handle);
      return;
    }

    if (pid > 0) {
      if ( !OS.AttachThreadInput(_threadid, pid, true)) {
        return;
      }
      OS.SetForegroundWindow(shell.handle);
      OS.AttachThreadInput(_threadid, pid, false);
    }

    OS.BringWindowToTop(shell.handle);
    OS.UpdateWindow(shell.handle);
    OS.SetActiveWindow(shell.handle);
}
项目:p2-installer    文件:Win32ActionsProvider.java   
@Override
public void bringToFront(Shell shell) {
    /**
     * SWT doesn't provide a direct means to bring the shell to the front on 
     * all Windows versions.  <code>Shell.forceActive</code> will not on 
     * more modern versions of Windows.  This method uses the workaround 
     * given in:
     * https://bugs.eclipse.org/bugs/show_bug.cgi?id=192036
     */
    long hFrom = OS.GetForegroundWindow();

    if (hFrom <= 0) {
        OS.SetForegroundWindow(shell.handle);
        return;
    }
    if (shell.handle == hFrom) {
        return;
    }
    int pid = OS.GetWindowThreadProcessId(hFrom, null);
    int _threadid = OS.GetWindowThreadProcessId(shell.handle, null);

    if (_threadid == pid) {
      OS.SetForegroundWindow(shell.handle);
      return;
    }

    if (pid > 0) {
      if ( !OS.AttachThreadInput(_threadid, pid, true)) {
        return;
      }
      OS.SetForegroundWindow(shell.handle);
      OS.AttachThreadInput(_threadid, pid, false);
    }

    OS.BringWindowToTop(shell.handle);
    OS.UpdateWindow(shell.handle);
    OS.SetActiveWindow(shell.handle);
}
项目:cogtool    文件:UncompressDibFilterInputStream.java   
public UncompressDibFilterInputStream(InputStream bmpFileStream)
                throws IOException {
        this.in = bmpFileStream;
        this.buffer = new byte[BITMAPINFOHEADER.sizeof];

        //read in the BITMAPINFOHEADER from the stream
        this.in.read(this.buffer, 0, this.buffer.length);
        BITMAPINFOHEADER origInfoHeader = new BITMAPINFOHEADER();
        ConversionUtil.fromBytes(origInfoHeader, this.buffer, 0);

        this.isCompressed = origInfoHeader.biCompression == OS.BI_BITFIELDS;

        if (this.isCompressed) {
                this.bitCount = origInfoHeader.biBitCount;

                origInfoHeader.biCompression = OS.BI_RGB;
                origInfoHeader.biSizeImage = 0;

                ConversionUtil.toBytes(origInfoHeader, this.buffer, 0);

                //read the next 12 bytes and just ignore them
                final byte[] redMaskBytes = new byte[4];
                final byte[] greenMaskBytes = new byte[4];
                final byte[] blueMaskBytes = new byte[4];

                this.in.read(redMaskBytes);
                this.in.read(greenMaskBytes);
                this.in.read(blueMaskBytes);

                this.redMask = ConversionUtil.bytesToInt(redMaskBytes, 0);
                this.greenMask = ConversionUtil.bytesToInt(greenMaskBytes, 0);
                this.blueMask = ConversionUtil.bytesToInt(blueMaskBytes, 0);
        }
}