Page 1 of 1

Get code when Press Minimze button.

PostPosted: October 26th, 2006, 3:36 pm
by Gullb3rg
Code: Select all

Public
  procedure WMSysCommand(var Msg: TWMSysCommand) ; message WM_SYSCOMMAND;

.........
procedure TForm1.WMSysCommand;
begin
   if (Msg.CmdType = SC_MINIMIZE) Then
       { code here }

This works fine. And I'm able to put code to add a icon in System Tray here. BUT, my form acts really strange. I can't move the form, can't maximize, can't close. So i tried to put

Code: Select all
if (Msg.CmdType = SC_CLOSE) Then
  Exit;


But that didn't work either. So i wonder if someone know who to solve this or got anorher code to put code when press Minimize button. Because i haven't found another code for that.

/Thanks

PostPosted: October 28th, 2006, 8:32 am
by Kambiz
If you want to do something when application is minimized, use Application.OnMinimize event.

If you want to do something when a specific window is minimized, look at parameters of WM_SIZE message.