I am having problems connecting the global system to work. I want to receive notifications when the window moves as early as possible and to resize the window. This means that the CBT hook HCBT_MOVESIZE will not cut it, it will only happen after moving the window. I want to bind the actual movement of the window and be able to resize the window while moving.
Hooks are specified from the DLL, and the callback function is inside this DLL. This is what I tried.
WH_CALLWNDPROC . It warns me when a window is moved ( WM_MOVING received for windows from other applications), but I cannot change the contents of the message.WH_CALLWNDPROCRET Same as WH_CALLWNDPROC .- CBT hook
HCBT_MOVESIZE . The event takes place until late. WH_GETMESSAGE . Never accept WM_MOVE , WM_MOVING or WM_WINDOWPOSCHANGING . This hook will allow me to change posts.
Update : Windows event interceptors seem to allow me to capture it:
hWinEventHook = SetWinEventHook(EVENT_SYSTEM_MOVESIZESTART, EVENT_SYSTEM_MOVESIZEEND, NULL, WinEventProc, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS);
However, this creates another problem: resizing a window using SetWindowPos() does not work (it SetWindowPos() in order, but immediately returns to its previous size), although I use SWP_NOSENDCHANGING . Ideas?
Update 2 . The subclass seems to work, but Visual Studio crashes after each program (like so many other windows). It works well if I put breakpoints and go through unsubclassing, but not when I let the program run on its own. Ideas?
I have a CBT hook (it was there before), and whenever HCBT_ACTIVATE sent for a new window, I delete any previous subclass using SetWindowLongPtr() (this should also be done on the 64-bit version) and then subclass the new window. If I put a breakpoint anywhere and immediately resume the session when it breaks, everything works fine. However, when I have no breakpoints, Visual Studio crashes when the program exits.
c ++ winapi
Vegard larsen
source share