我正在尝试编写一个 dll 来拦截调整大小的窗口,但我无法理解在这种情况下如何正确指定 lParam。
从文档:
HCBT_MOVESIZE:指定一个指向包含窗口坐标的 RECT 结构的长指针。通过改变结构中的值,CBTProc 钩子过程可以设置窗口的最终坐标。
当前代码:
#include "pch.h"
#include <Windows.h>
extern "C" __declspec(dllexport) LRESULT CALLBACK CBTProc(
_In_ int nCode,
_In_ WPARAM wParam,
_In_ LPARAM lParam
)
{
if (nCode < 0) return CallNextHookEx(nullptr, nCode, wParam, lParam);
switch(nCode)
{
case HCBT_MOVESIZE: // A window is about to be moved or sized.
/*
For operations corresponding to the following CBT hook codes, the return value must be 0 to allow the operation, or 1 to prevent …Run Code Online (Sandbox Code Playgroud)