zoukankan      html  css  js  c++  java
  • How to change windows applicatioin's position via Win32 API

    可以使用的Win32 API是:

    [DllImport("user32.dll")]
    private extern static bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags);
    static void SetWindowPosition(string locationURL)
            {
                SHDocVw.ShellWindows windows = new SHDocVw.ShellWindows();
                SHDocVw.InternetExplorer currentWindow = null;
                foreach (SHDocVw.InternetExplorer window in windows)
                {
                    if (window.LocationURL.Contains(locationURL))
                    {
                        currentWindow = window;
                        break;
                    }
                }
    
                if (currentWindow != null)
                {
                    IntPtr handle = (IntPtr)currentWindow.HWND;
                    var width = Screen.PrimaryScreen.Bounds.Width;
                    var height = Screen.PrimaryScreen.Bounds.Height;
                    SetWindowPos(handle, (IntPtr)0, width / 2, 0, width / 2, height, 0x0040);
                }
            }
  • 相关阅读:
    CSS 层叠样式表
    一. 图论
    二. log4j配置文件
    三.注解
    3. Map与Tuple
    MappedByteBuffer读写文件
    2. scala中的数组
    1.scala语法
    二. 模式匹配
    一.算法的数学基础
  • 原文地址:https://www.cnblogs.com/supperwu/p/7206697.html
Copyright © 2011-2022 走看看