Sorry bad idea; the WM_GetMINMAXInfo does not trap those commands but this
does.
procedure WMSysCommand(var MSG: TMessage); message WM_SYSCOMMAND;
procedure tform1.WMSysCommand(var MSG: TMessage);
begin
case (Msg.WParam and $FFF0) of
SC_MAXIMIZE : ShowMessage('Maximize');
SC_MINIMIZE : ShowMessage('Minimize');
SC_RESTORE : ShowMessage('Restore');
end;
inherited;
end;
Note: Clicking the icon in the taskbar (to show/hide) does not trigger those
events. It might trigger something else.
Some blurb from the Help File;
A window receives this message when the user chooses a command from the
window menu (also known as the System menu or Control menu) or when the user
chooses the Maximize button or Minimize button.
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.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Alistair George
Sent: Wednesday, July 21, 1999 3:16 PM
To: Multiple recipients of list delphi
Subject: [DUG]: Min/max windows
Afternoon.
anyone know how to detect minimise and maximise of the window. WM_SIZE is no
good, because the window is only being minimised to taskbar, or maximised to
fullsize, not resized, so the following is not applicable:
procedure WMSize(var Message: TWMSize); message WM_SIZE;
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz