Задача: изменить координаты создаваемого окна, используя хуки.
В msdn написано:
| Цитата | | At the time of the HCBT_CREATEWND notification, the window has been created, but its final size and position may not have been determined and its parent window may not have been established. It is possible to send messages to the newly created window, although it has not yet received WM_NCCREATE or WM_CREATE messages. It is also possible to change the position in the z-order of the newly created window by modifying the hwndInsertAfter member of the CBT_CREATEWND structure. |
Но я так и не нашел конкретного примера, показывающего как можно изменить Z координату создаваемого окна, изменив hwndInsertAfter. Покажите, пожалуйста, этот пример.
Вот код моей dll:
| Код | library my_dll; uses Windows; var SysHook : HHook = 0; function CBTProc(code : integer; wParam : wParam; lParam : longint) : longint; stdcall; begin if Code>=0 then begin case Code of HCBT_CREATEWND: begin //тут изменяем координаты создаваемого окна end; end; Result := 0; end else Result:= CallNextHookEx(SysHook, Code, wParam, lParam); end; procedure hook export; stdcall; begin SysHook := SetWindowsHookEx(WH_CBT, @CBTProc, HInstance, 0); end; procedure unhook export; stdcall; begin UnhookWindowsHookEx(SysHook); end; exports hook,unhook; begin end. |
|