【发布时间】:2010-06-14 13:02:38
【问题描述】:
我正在使用 WMSysCommand 消息来修改标题栏按钮(最大化/最小化)的行为,并且最近的更新需要使用 WMNCHitTest,但由于代码冗长,我不想在乘法过程中拆分这两个相关消息。
我可以从其他消息中访问私有声明(消息)吗?如果可以的话 - 怎么做?
procedure TForm1.WMNCHitTest(var Msg: TWMNCHitTest) ;
begin
SendMessage(Handle, HTCAPTION, WM_NCHitTest, 0); // or other wParam or lParam ????
end;
procedure TForm1.WMSysCommand;
begin
if (Msg.CmdType = SC_MAXIMIZE or 61488) or (Msg.Result = htCaption or 2) then // if command is Maximize or reciever message of Caption Bar click
begin
if CheckWin32Version(6, 0) then
Constraints.MaxHeight := 507
else
Constraints.MaxHeight := 499;
Constraints.MaxWidth := 0;
end
else if (Msg.CmdType = SC_MINIMIZE or 61472) or (Msg.Result = htCaption or 2) then // if command is Minimize
begin
if (EnsureRange(Width, 252, 510) >= (510 / 2)) then
PreviewOpn.Caption := '<'
else
PreviewOpn.Caption := '>';
end;
DefaultHandler(Msg); // reset Message handler to default ( Application )
end;
Soo ...我是正确地认为并且只是不知道正确的命令还是我在想完全废话*t?
问候。感谢您的帮助...
【问题讨论】:
-
看起来您应该问的问题是:如何修改标题栏按钮的行为?
-
Wll - 不太好。最合适的做法是 - 如何从其他 WM 程序中模仿 WM ..."",但我没有输入它,因为它在某种意义上是黑客预定义了操作系统行为 ...不想在这里与版主进行一些严肃的交谈。