通常我们都是用拦截WM_NCHITTEST消息来移动无标题的窗口,介绍这个用法的文章很多,可是用WM_NCHITTEST同样能禁止窗口移动.
TForm1 = class(TForm)
private
{ Private declarations }
procedure WMNCHITTEST(var Msg: TWMNCHITTEST); message WM_NCHITTEST;
procedure TForm1.WMNCHITTEST(var Msg: TWMNCHITTEST);
begin
inherited;
if Msg.Result = HTCAPTION then
Msg.Result := 0
end;
文章转自:http://www.cnill.com/jibing/lunwen/process/200702/lunwen_50946.shtml
TForm1 = class(TForm)
private
{ Private declarations }
procedure WMNCHITTEST(var Msg: TWMNCHITTEST); message WM_NCHITTEST;
procedure TForm1.WMNCHITTEST(var Msg: TWMNCHITTEST);
begin
inherited;
if Msg.Result = HTCAPTION then
Msg.Result := 0
end;
文章转自:http://www.cnill.com/jibing/lunwen/process/200702/lunwen_50946.shtml
禁用窗口移动技巧
本文介绍了一种通过重写WM_NCHITTEST消息处理过程来禁用Windows应用程序中窗口移动的方法。具体实现是在 TForm1 类中定义 WMNCHITTEST 消息处理函数,当检测到鼠标点击标题栏时(HTCAPTION),将返回值设为0以阻止窗口响应移动操作。
432

被折叠的 条评论
为什么被折叠?



