将窗口脱钩至其原始状态

2024-04-10

我使用以下代码将窗口挂接到面板中:

SetParent(win, pnlApp.Handle);
SetWindowLong(win, GWL_STYLE, WS_VISIBLE);
MoveWindow(win, 0, 0, pnlApp.Width, pnlApp.Height, true);

where win是窗口句柄,作为IntPtr。这里考虑一下记事本,它可以很好地连接到面板中。
但当我尝试release(取消挂钩)使用以下代码:

SetParent(win, (IntPtr)0);

显示时没有窗框!我的意思是它将再次释放到桌面中,但它没有任何窗口框架。

如何解决这个问题?


关于问题中的代码:

  • 设置窗口长() https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowlongw应替换为设置窗口长指针() https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowlongptrw- 参见warning在文档中。后者在调用代码需要时调用前者。

  • 你需要打电话获取窗口长指针() https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getwindowlongptrw获取当前的窗口样式,然后根据需要添加或删除样式;存储原始值:它将用于恢复之前的状态。
    ► 在示例中,WS_SYSMENU样式被删除,因此窗口将不会显示系统菜单和通常位于标题中的所有按钮。这只是一个例子,看看它是如何工作的(它可能不适用于所有 Windows)。

  • 设置父级() https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setparent返回前一个父级的句柄。存储此值,将需要将窗口恢复到其先前的所有者(无论是什么)。如果该窗口是顶级窗口,则前一个父窗口appears是桌面,所以你可能会期望IntPtr.Zero。可能不是,你可以获得一个不是的句柄IntPtr.Zero。只要存储返回的值,看看它是什么,如果你有兴趣:)

  • 您应该检查两者的返回值GetWindowLongPtr() and SetWindowLongPtr(): 如果它是0,然后出现错误。您可以使用Marshal.GetLastWin32Error() https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.marshal.getlastwin32error获取错误代码。注意SetWindowLongPtr()不会清除错误代码,因此您必须自己清除它,调用设置最后一个错误(0) https://learn.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-setlasterror.

  • 您可以使用移动窗口() https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-movewindow将 Windows 重新定位在新 Parent 的边界内;我建议打电话设置窗口位置() https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowpos相反,你有更多的选择。请参阅此处的代码。

Disclaimer: keep in mind what's in Raymond Chen's blog post:
Is it legal to have a cross-process parent/child or owner/owned window relationship https://devblogs.microsoft.com/oldnewthing/20130412-00/?p=4683
In other words, it's a just because you asked thing :)


设置这些字段(或任何合适的字段):

  • windowdHwnd是窗口的句柄重新成为父母
  • oldParent是前一个父级的句柄,由以下方法返回SetParent()
  • oldStyles将存储以前的窗口样式,由GetWindowLongPtr()
IntPtr windowdHwnd = IntPtr.Zero;
IntPtr oldParent = (IntPtr)(-1);
int oldStyles = 0;
// [...]

当您拥有您关心的窗口句柄时,设置windowdHwnd到这个值。之后调用此代码(它可以是一个方法,传递窗口句柄和将成为新父级的容器控件 - 这里是一个名为somePanel).

// Already parented, resets the previous styles, clean up and return
if (windowdHwnd != IntPtr.Zero && oldParent != (IntPtr)(-1)) {
    NativeMethods.SetParent(windowdHwnd, oldParent);
    NativeMethods.SetWindowLongPtr(windowdHwnd, NativeMethods.GWL_Flags.GWL_STYLE, new IntPtr(oldStyles));
    windowdHwnd = IntPtr.Zero;
    oldParent = (IntPtr)(-1);
    return;
}

// Store the existing Styles, to restore when the Window is dismissed
oldStyles = NativeMethods.GetWindowLongPtr(windowdHwnd, NativeMethods.GWL_Flags.GWL_STYLE);
if (oldStyles == IntPtr.Zero) {
    int error = Marshal.GetLastWin32Error();  // Show the error code or throw an exception
    return;
}

// Removes the System Menu from the Window: it will also remove the Buttons from the Caption
int newStyle = oldStyles.ToInt32()^ (int)NativeMethods.WinStyles.WS_SYSMENU;

NativeMethods.SetLastError(0);
// Sets the new Styles
IntPtr result = NativeMethods.SetWindowLongPtr(windowdHwnd, NativeMethods.GWL_Flags.GWL_STYLE, (IntPtr)newStyle);
if (result == IntPtr.Zero) {
    int error = Marshal.GetLastWin32Error();  // Show the error code or throw an exception
    return;
}

oldParent = NativeMethods.SetParent(windowdHwnd, somePanel.Handle);

// Repositions the Window and shows it, if needed
var flags = NativeMethods.SWP_Flags.SWP_ASYNCWINDOWPOS | NativeMethods.SWP_Flags.SWP_SHOWWINDOW;
NativeMethods.SetWindowPos(windowdHwnd, IntPtr.Zero, 0, 0, somePanel.Width, somePanel.Height, flags);

你可以写(这只是删除):

int newStyle = oldStyles &~(int)NativeMethods.WinStyles.WS_SYSMENU;

而不是(这会打开/关闭):

int newStyle = oldStyles ^ (int)NativeMethods.WinStyles.WS_SYSMENU;

NativeMethods class:

using System.Runtime.InteropServices;

public class NativeMethods
{
    [Flags]
    public enum SWP_Flags : uint
    {
        /// <summary>Retains the current size (ignores the cx and cy parameters).</summary>
        SWP_NOSIZE = 0x0001,
        /// <summary>Retains the current position (ignores X and Y parameters).</summary>
        SWP_NOMOVE = 0x0002,
        /// <summary>Retains the current Z order (ignores the hWndInsertAfter parameter).</summary>
        SWP_NOZORDER = 0x0004,
        /// <summary>Does not redraw changes. If this flag is set, no repainting of any kind occurs. This applies to
        /// the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent
        /// window uncovered as a result of the window being moved. When this flag is set, the application must
        /// explicitly invalidate or redraw any parts of the window and parent window that need redrawing.</summary>
        SWP_NOREDRAW = 0x0008,
        /// <summary>Does not activate the window. If this flag is not set, the window is activated and moved to the
        /// top of either the topmost or non-topmost group (depending on the setting of the hWndInsertAfter
        /// parameter).</summary>
        SWP_NOACTIVATE = 0x0010,
        /// <summary>Draws a frame (defined in the window's class description) around the window.</summary>
        SWP_DRAWFRAME = 0x0020,
        /// <summary>Applies new frame styles set using the SetWindowLong function. Sends a WM_NCCALCSIZE message to
        /// the window, even if the window's size is not being changed. If this flag is not specified, WM_NCCALCSIZE
        /// is sent only when the window's size is being changed.</summary>
        SWP_FRAMECHANGED = 0x0020,
        /// <summary>Displays the window.</summary>
        SWP_SHOWWINDOW = 0x0040,
        /// <summary>Hides the window.</summary>
        SWP_HIDEWINDOW = 0x0080,
        /// <summary>Discards the entire contents of the client area. If this flag is not specified, the valid
        /// contents of the client area are saved and copied back into the client area after the window is sized or
        /// repositioned.</summary>
        SWP_NOCOPYBITS = 0x0100,
        /// <summary>Does not change the owner window's position in the Z order.</summary>
        SWP_NOOWNERZORDER = 0x0200,
        /// <summary>Same as the SWP_NOOWNERZORDER flag.</summary>
        SWP_NOREPOSITION = 0x0200,
        /// <summary>Prevents the window from receiving the WM_WINDOWPOSCHANGING message.</summary>
        SWP_NOSENDCHANGING = 0x0400,
        /// <summary>Internal use.</summary>
        SWP_NOCLIENTSIZE = 0x0800,
        /// <summary>Internal use.</summary>
        SWP_NOCLIENTMOVE = 0x1000,
        /// <summary>Prevents generation of the WM_SYNCPAINT message.</summary>
        SWP_DEFERERASE = 0x2000,
        /// <summary>If the calling thread and the thread that owns the window are attached to different input queues,
        /// the system posts the request to the thread that owns the window. This prevents the calling thread from
        /// blocking its execution while other threads process the request.</summary>
        SWP_ASYNCWINDOWPOS = 0x4000
    }

    [Flags]
    public enum WinStyles : uint
    {
        WS_BORDER = 0x00800000,                     //The window has a thin-line border.
        WS_CAPTION = 0x00C00000,                    //The window has a title bar (includes the WS_BORDER style).
        WS_CHILD = 0x40000000,                      //The window is a child window. A window with this style cannot have a menu bar. This style cannot be used with the WS_POPUP style.
        WS_CHILDWINDOW = 0x40000000,                //Same as the WS_CHILD style.
        WS_CLIPCHILDREN = 0x02000000,               //Excludes the area occupied by child windows when drawing occurs within the parent window. This style is used when creating the parent window.
        WS_CLIPSIBLINGS = 0x04000000,               //Clips child windows relative to each other; that is, when a particular child window receives a WM_PAINT message, the WS_CLIPSIBLINGS style clips all other overlapping child windows out of the region of the child window to be updated. If WS_CLIPSIBLINGS is not specified and child windows overlap, it is possible, when drawing within the client area of a child window, to draw within the client area of a neighboring child window.
        WS_DISABLED = 0x08000000,                   //The window is initially disabled. A disabled window cannot receive input from the user. To change this after a window has been created, use the EnableWindow function.
        WS_DLGFRAME = 0x00400000,                   //The window has a border of a style typically used with dialog boxes. A window with this style cannot have a title bar.
        WS_GROUP = 0x00020000,                      //The window is the first control of a group of controls. The group consists of this first control and all controls defined after it, up to the next control with the WS_GROUP style. The first control in each group usually has the WS_TABSTOP style so that the user can move from group to group. The user can subsequently change the keyboard focus from one control in the group to the next control in the group by using the direction keys.
                                                    //You can turn this style on and off to change dialog box navigation. To change this style after a window has been created, use the SetWindowLong function.
        WS_HSCROLL = 0x00100000,                    //The window has a horizontal scroll bar.
        WS_ICONIC = 0x20000000,                     //The window is initially minimized. Same as the WS_MINIMIZE style.
        WS_MAXIMIZE = 0x01000000,                   //The window is initially maximized.
        WS_MAXIMIZEBOX = 0x00010000,                //The window has a maximize button. Cannot be combined with the WS_EX_CONTEXTHELP style. The WS_SYSMENU style must also be specified.
        WS_MINIMIZE = 0x20000000,                   //The window is initially minimized. Same as the WS_ICONIC style.
        WS_MINIMIZEBOX = 0x00020000,                //The window has a minimize button. Cannot be combined with the WS_EX_CONTEXTHELP style. The WS_SYSMENU style must also be specified.
        WS_OVERLAPPED = 0x00000000,                 //The window is an overlapped window. An overlapped window has a title bar and a border. Same as the WS_TILED style.
        WS_OVERLAPPEDWINDOW = WS_OVERLAPPED |       //The window is an overlapped window. Same as the WS_TILEDWINDOW style.
                              WS_CAPTION |
                              WS_SYSMENU |
                              WS_THICKFRAME |
                              WS_MINIMIZEBOX |
                              WS_MAXIMIZEBOX,
        WS_POPUP = 0x80000000,                      //The windows is a pop-up window. This style cannot be used with the WS_CHILD style.
        WS_POPUPWINDOW = WS_POPUP |                 //The window is a pop-up window. The WS_CAPTION and WS_POPUPWINDOW styles must be combined to make the window menu visible.
                         WS_BORDER |
                         WS_SYSMENU,
        WS_SIZEBOX = 0x00040000,                    //The window has a sizing border. Same as the WS_THICKFRAME style.
        WS_SYSMENU = 0x00080000,                    //The window has a window menu on its title bar. The WS_CAPTION style must also be specified.
        WS_TABSTOP = 0x00010000,                    //The window is a control that can receive the keyboard focus when the user presses the TAB key. Pressing the TAB key changes the keyboard focus to the next control with the WS_TABSTOP style.
                                                    //You can turn this style on and off to change dialog box navigation. To change this style after a window has been created, use the SetWindowLong function. For user-created windows and modeless dialogs to work with tab stops, alter the message loop to call the IsDialogMessage function.
        WS_THICKFRAME = 0x00040000,                 //The window has a sizing border. Same as the WS_SIZEBOX style.
        WS_TILED = 0x00000000,                      //The window is an overlapped window. An overlapped window has a title bar and a border. Same as the WS_OVERLAPPED style.
        WS_TILEDWINDOW = WS_OVERLAPPED |            //The window is an overlapped window. Same as the WS_OVERLAPPEDWINDOW style.
                         WS_CAPTION |
                         WS_SYSMENU |
                         WS_THICKFRAME |
                         WS_MINIMIZEBOX |
                         WS_MAXIMIZEBOX,
        WS_VISIBLE = 0x10000000,                   //The window is initially visible. This style can be turned on and off by using the ShowWindow or SetWindowPos function.
        WS_VSCROLL = 0x00200000,                   //The window has a vertical scroll bar.
    }

    public enum GWL_Flags : int
    {
        GWL_USERDATA = -21,
        GWL_EXSTYLE = -20,
        GWL_STYLE = -16,
        GWL_ID = -12,
        GWLP_HWNDPARENT = -8,
        GWLP_HINSTANCE = -6,
        GWL_WNDPROC = -4,
        DWLP_MSGRESULT = 0x0,
        DWLP_DLGPROC = 0x4,
        DWLP_USER = 0x8
    }


    [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
    internal static extern IntPtr GetWindowLongPtr(IntPtr hWnd, GWL_Flags nIndex);

    [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
    internal static extern IntPtr SetWindowLongPtr(IntPtr hWnd, GWL_Flags nIndex, IntPtr dwNewLong);

    [DllImport("user32.dll", SetLastError = true)]
    internal static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

    [DllImport("user32.dll", SetLastError = true)]
    internal static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, SWP_Flags uFlags);

    [DllImport("kernel32.dll")]
    internal static extern void SetLastError(uint dwErrCode);
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

将窗口脱钩至其原始状态 的相关文章

  • Qt-Qlist 检查包含自定义类

    有没有办法覆盖加载自定义类的 Qt QList 的比较机制 即在 java 中你只需要重写一个比较方法 我有一个带有我的自定义类模型的 QList QList
  • 当我使用“control-c”关闭发送对等方的套接字时,为什么接收对等方的套接字不断接收“”

    我是套接字编程的新手 我知道使用 control c 关闭套接字是一个坏习惯 但是为什么在我使用 control c 关闭发送进程后 接收方上的套接字不断接收 在 control c 退出进程后 发送方的套接字不应该关闭吗 谢谢 我知道使用
  • 从父类调用子类方法

    a doStuff 方法是否可以在不编辑 A 类的情况下打印 B did stuff 如果是这样 我该怎么做 class Program static void Main string args A a new A B b new B a
  • 如何避免情绪低落?

    我有一个实现状态模式每个状态处理从事件队列获取的事件 根据State因此类有一个纯虚方法void handleEvent const Event 事件继承基础Event类 但每个事件都包含其可以是不同类型的数据 例如 int string
  • 如何在列表框项目之间画一条线

    我希望能够用水平线分隔列表框中的每个项目 这只是我用于绘制项目的一些代码 private void symptomsList DrawItem object sender System Windows Forms DrawItemEvent
  • C++ 子字符串返回错误结果

    我有这个字符串 std string date 20121020 我正在做 std cout lt lt Date lt lt date lt lt n std cout lt lt Year lt lt date substr 0 4 l
  • 当 contains() 工作正常时,xpath 函数ends-with() 工作时出现问题

    我正在尝试获取具有以特定 id 结尾的属性的标签 like span 我想获取 id 以 国家 地区 结尾的跨度我尝试以下xpath span ends with id Country 但我得到以下异常 需要命名空间管理器或 XsltCon
  • 为什么#pragma optimize("", off)

    我正在审查一个 C MFC 项目 在某些文件的开头有这样一行 pragma optimize off 我知道这会关闭所有以下功能的优化 但这样做的动机通常是什么 我专门使用它来在一组特定代码中获得更好的调试信息 并在优化的情况下编译应用程序
  • 将目录压缩为单个文件的方法有哪些

    不知道怎么问 所以我会解释一下情况 我需要存储一些压缩文件 最初的想法是创建一个文件夹并存储所需数量的压缩文件 并创建一个文件来保存有关每个压缩文件的数据 但是 我不被允许创建许多文件 只能有一个 我决定创建一个压缩文件 其中包含有关进一步
  • 如果使用 SingleOrDefault() 并在数字列表中搜索不在列表中的数字,如何返回 null?

    使用查询正数列表时SingleOrDefault 当在列表中找不到数字时 如何返回 null 或像 1 这样的自定义值 而不是类型的默认值 在本例中为 0 你可以使用 var first theIntegers Cast
  • Cython 和类的构造函数

    我对 Cython 使用默认构造函数有疑问 我的 C 类 Node 如下 Node h class Node public Node std cerr lt lt calling no arg constructor lt lt std e
  • Qt moc 在头文件中实现?

    是否可以告诉 Qt MOC 我想声明该类并在单个文件中实现它 而不是将它们拆分为 h 和 cpp 文件 如果要在 cpp 文件中声明并实现 QObject 子类 则必须手动包含 moc 文件 例如 文件main cpp struct Sub
  • 如何将图像路径保存到Live Tile的WP8本地文件夹

    我正在更新我的 Windows Phone 应用程序以使用新的 WP8 文件存储 API 本地文件夹 而不是 WP7 API 隔离存储文件 旧的工作方法 这是我如何成功地将图像保存到 共享 ShellContent文件夹使用隔离存储文件方法
  • 如何将单个 char 转换为 int [重复]

    这个问题在这里已经有答案了 我有一串数字 例如 123456789 我需要提取它们中的每一个以在计算中使用它们 我当然可以通过索引访问每个字符 但是如何将其转换为 int 我研究过 atoi 但它需要一个字符串作为参数 因此 我必须将每个字
  • Qt表格小部件,删除行的按钮

    我有一个 QTableWidget 对于所有行 我将一列的 setCellWidget 设置为按钮 我想将此按钮连接到删除该行的函数 我尝试了这段代码 它不起作用 因为如果我只是单击按钮 我不会将当前行设置为按钮的行 ui gt table
  • 通过win32检测多个登录用户

    使用标准 win32 api 检测多个用户登录的最佳方法是什么 我对我们的软件产品进行了升级 当多个用户登录时 该产品无法运行 我知道这是应该避免的事情 因为它很烦人 但该产品非常复杂 您必须相信我 当我说确实没有其他解决方案时 谢谢 为了
  • 将 xml 反序列化为类,list<> 出现问题

    我有以下 XML
  • 将文本叠加在图像背景上并转换为 PDF

    使用 NET 我想以编程方式创建一个 PDF 它仅包含一个背景图像 其上有两个具有不同字体和位置的标签 我已阅读过有关现有 PDF 库的信息 但不知道 如果适用 哪一个对于如此简单的任务来说最简单 有人愿意指导我吗 P D 我不想使用生成的
  • Process.Start 阻塞

    我正在调用 Process Start 但它会阻止当前线程 pInfo new ProcessStartInfo C Windows notepad exe Start process mProcess new Process mProce
  • mysql-connector-c++ - “get_driver_instance”不是“sql::mysql”的成员

    我是 C 的初学者 我认为学习的唯一方法就是接触一些代码 我正在尝试构建一个连接到 mysql 数据库的程序 我在 Linux 上使用 g 没有想法 我运行 make 这是我的错误 hello cpp 38 error get driver

随机推荐

  • 服务器在区域设置中设置为 en-GB,但日期时间解析为 en-US

    我通过将每条记录推送到验证阶段 然后将其放入数据库来处理记录 验证步骤之一需要检查某些列是否是日期 我使用 DateTime TryParse s out DateTime 执行此操作 假设这将使用运行进程的计算机上配置的区域设置 在我的本
  • 如何在 ASMACK 中解析 CustomIQ

    我正在我的应用程序中使用 ASMACK 库 我从我的服务器收到以下 IQ
  • 如何使用 NavController 导航片段而不将其添加到后台堆栈中?

    NavController有方法navigate默认情况下使用 backstack 进行导航 如何在没有后退堆栈的情况下导航到片段 请注意 我不是在问FragmentTransaction 如果你有一个后堆栈 A gt B 并想要获得一个后
  • 插件在 Windows 7 64 位上的 Eclipse 中不起作用

    在我全新的Windows 7机器上 我下载了Eclipse Galileo 和几个Eclipse插件 Android的ADT插件 Subclipse等 重新启动后 这些插件都没有显示在 IDE 中 首选项 菜单等中没有显示任何内容 但如果我
  • Await 将控制权返回给调用者——谁在等待的任务中执行同步代码?

    当遇到等待时 控制权返回给调用者 而等待的任务在后台运行 发出 等待网络请求 响应 我知道等待任务在等待网络响应时不需要线程 因为它实际上并没有运行任何东西 只是在等待 我想问 假设在等待的函数中 有一些同步代码 例如Console Wri
  • SVG图案动画

    我在 svg 中定义了一个模式 我想连续旋转它 我无法在该图案定义上应用动画 我将相同的动画应用于符号 它可以工作 但不能在图案上工作
  • 集成到 VNET 后无法连接到 Azure Function App

    问题概要 Azure Function App 集成到 VNET 且 WEBSITE VNET ROUTE ALL 设置为 1 后将无法访问 这是必需的 以便 Function App 可以安全地连接到 SQL 而无需公开 SQL Erro
  • 在继承类中扩展 wagtail Streamfields

    我有一个抽象类 其中有 ha StreamField 我还有一个继承自 BasePage 的类 CustomPage 我希望 CustomPage 向内容添加新的 StructBlock 我怎么做 class BasePage Page c
  • 如何在php中加密/解密数据?

    我目前是一名学生 正在学习 PHP 我正在尝试在 PHP 中对数据进行简单的加密 解密 我做了一些在线研究 其中一些非常令人困惑 至少对我来说 这就是我想做的 我有一个由这些字段组成的表 用户 ID 姓名 姓名 电子邮件 密码 我想要的是对
  • iPhone 的总内存

    我想知道Total我的 iPhone 中可用的 RAM 为此 我使用了以下代码 注意 请不要将此问题解释为检索 RAM 统计信息 例如 有线 非活动 活动 和 空闲 mach port t host port mach msg type n
  • HTML 5 通知无法在 Chrome 本地工作?

    我找到了以下 HTML 通知示例 它在 Chrome 和 Firefox 中运行良好 下载并在本地尝试后 它不再在 Chrome 中运行 这是预期的行为 Chrome 由于某种原因阻止本地通知 还是有其他原因导致此功能不起作用
  • Apyori 相关性测度

    我在用着Apyori https pypi org project apyori 库作为 Apriori 算法的实现 rules apriori trs min support 0 02 min confidence 0 1 min lif
  • 如何在 OpenGL ES 1.1 上用不同的纹理填充立方体的每一面?

    请 我需要教程 代码示例 了解如何在 OpenGL ES 1 1 上用不同的纹理填充立方体的每一面 我找到了很多教程 但没有一个教程清楚地解释了如何在每个面上放置不同的纹理 也没有一个提供简单的代码示例来说明如何做到这一点 我的实际代码 来
  • Haskell——从具体类型实例获取 TypeRep

    我想编写一个具有这种类型签名的函数 getTypeRep Typeable a gt t a gt TypeRep 其中 TypeRep 将是类型表示a 不是为了t a 也就是说 编译器应该在任何调用站点自动返回正确的类型表示 to获取类型
  • 在 Azure Web 应用程序上运行 Selenium

    我有一个 Azure Web 应用程序 当我在控制器上调用操作时 我想用它来屏幕抓取网站 如下所示 var driver new PhantomJSDriver driver Url http url com driver Navigate
  • Laravel:file_put_contents() 权限被拒绝 - 正确的存储/框架/缓存权限?

    我在编辑 Laravel 缓存时遇到了困难 它位于storage framework cache 我正在运行一个保存到某个缓存的作业 但是每次运行该作业时 都会发生此错误 ERROR file put contents var www ht
  • 继承和组合有什么区别?

    正如标题所说 两者的含义都让我困惑 继承表达了一个is a关系 而组合表达了has a两个类之间的关系 组合的一个示例是多边形 它具有有序的点序列 用 C 术语来说 struct Polygon std vector
  • CssSyntaxError - Tailwind 和 Next.js 项目中的未知单词

    10 小时后 由于以下构建失败 仍然无法部署我的应用程序 将 React Next 与 Tailwind 结合使用 我相信它来自 PostCSS 插件 但我找不到任何错误 如果有的话 它在生产构建之前在本地主机上完美运行 有什么方法可以识别
  • 如何将点击传播到光标下的所有div?

    我有一堆 div 绝对位于彼此之上 当我将点击事件绑定到所有这些时 只有顶部的 div 响应 如何将事件发送到光标下的所有div 采纳 FelixKling 的建议使用document elementFromPoint 和 Amberlam
  • 将窗口脱钩至其原始状态

    我使用以下代码将窗口挂接到面板中 SetParent win pnlApp Handle SetWindowLong win GWL STYLE WS VISIBLE MoveWindow win 0 0 pnlApp Width pnlA