zoukankan      html  css  js  c++  java
  • C# WPF 让你的窗口始终钉在桌面上

                IntPtr hWnd = new WindowInteropHelper(Application.Current.MainWindow).Handle;
                IntPtr hWndProgMan = FindWindow("Progman", "Program Manager");
                SetParent(hWnd, hWndProgMan);
    

      

            [DllImport("user32.dll", SetLastError = true)]
            static extern int SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong);
            [DllImport("user32.dll", SetLastError = true)]
            static extern IntPtr FindWindow(string lpWindowClass, string lpWindowName);
            [DllImport("user32.dll", SetLastError = true)]
            static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, string windowTitle);
            const int GWL_HWNDPARENT = -8;
            [DllImport("user32.dll")]
            static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
    

      

     var handle = new WindowInteropHelper(Application.Current.MainWindow).Handle;
                IntPtr hprog = FindWindowEx(
                    FindWindowEx(
                        FindWindow("Progman", "Program Manager"),
                        IntPtr.Zero, "SHELLDLL_DefView", ""
                    ),
                    IntPtr.Zero, "SysListView32", "FolderView"
                );
                SetWindowLong(handle, GWL_HWNDPARENT, hprog);
    

      

  • 相关阅读:
    服务器内部模拟Http请求
    面试题分类
    Linux常用命令
    css补充之hover与overflow
    css之position
    css边框及float、display样式
    css存在形式及优先级
    css选择器
    body标签之fieldest与label标签
    body内标签之table标签
  • 原文地址:https://www.cnblogs.com/liulun/p/4997825.html
Copyright © 2011-2022 走看看