用消息控制窗体最大化出现的问题

jadesun 2005-03-02 01:28:55
private
procedure WMSysCommand(var Message: TWMSysCommand); message WM_SYSCOMMAND;

procedure TLoadDownFrm.WMSysCommand(var Message: TWMSysCommand);
begin
IF (Message.CmdType = MAXIMIZE) Then
Begin
//问题2
End;
end;


出现如下错误提示:

[Error] UpData.pas(84): Undeclared identifier: 'MAXIMIZE'

晕倒了,用 SC_MINIMIZE 就行。这是怎么回事?


怎么写在出现最大化消息后,忽略该消息。窗体保持原状?
...全文
116 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
caiso 2005-03-04
  • 打赏
  • 举报
回复
顶一下
纯冰糖 2005-03-02
  • 打赏
  • 举报
回复
Message.CmdType = SC_MAXIMIZE
biku 2005-03-02
  • 打赏
  • 举报
回复
当然用SC_MAXIMIZE了,你那个MAXIMIZE是从哪来的?
li_chengbin 2005-03-02
  • 打赏
  • 举报
回复
看看Win32 SDK是怎么说的
WM_SYSCOMMAND
uCmdType = wParam; // type of system command requested
xPos = LOWORD(lParam); // horizontal postion, in screen coordinates
yPos = HIWORD(lParam); // vertical postion, in screen coordinates


Parameters

uCmdType

Specifies the type of system command requested. This can be one of these values:

Value Meaning
SC_CLOSE Closes the window.
SC_CONTEXTHELP Changes the cursor to a question mark with a pointer. If the user then clicks a control in the dialog box, the control receives a WM_HELP message.
SC_DEFAULT Selects the default item; the user double-clicked the window menu.
SC_HOTKEY Activates the window associated with the application-specified hot key. The low-order word of lParam identifies the window to activate.
SC_HSCROLL Scrolls horizontally.
SC_KEYMENU Retrieves the window menu as a result of a keystroke.
SC_MAXIMIZE (or SC_ZOOM) Maximizes the window.
SC_MINIMIZE (or SC_ICON) Minimizes the window.
SC_MONITORPOWER Windows 95 only: Sets the state of the display. This command supports devices that have power-saving features, such as a battery-powered personal computer.
SC_MOUSEMENU Retrieves the window menu as a result of a mouse click.
SC_MOVE Moves the window.
SC_NEXTWINDOW Moves to the next window.
SC_PREVWINDOW Moves to the previous window.
SC_RESTORE Restores the window to its normal position and size.
SC_SCREENSAVE Executes the screen saver application specified in the [boot] section of the SYSTEM.INI file.
SC_SIZE Sizes the window.
SC_TASKLIST Executes or activates Windows Task Manager.
SC_VSCROLL Scrolls vertically.


xPos

Specifies the horizontal position of the cursor, in screen coordinates, if a window menu command is chosen with the mouse. Otherwise, the xPos parameter is not used.

yPos

Specifies the vertical position of the cursor, in screen coordinates, if a window menu command is chosen with the mouse. This parameter is -1 if the command is chosen using a system accelerator, or zero if using a mnenomic.

procedure TForm1.WMSysCommand(var Message: TWMSysCommand);
begin
if Message.CmdType = SC_MAXIMIZE then
begin
Message.Result := 1;
Exit;
end;
inherited;
end;
caiso 2005-03-02
  • 打赏
  • 举报
回复
顶一下

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧