## Get code when Press Minimze button.

Please discuss general Delphi programming topics here.

### Get code when Press Minimze button.

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
Gullb3rg
Member

Posts: 4
Joined: October 26th, 2006, 3:31 pm

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.
Kambiz

Kambiz