Get code when Press Minimze button.

Please discuss general Delphi programming topics here.

Get code when Press Minimze button.

Postby Gullb3rg » October 26th, 2006, 3:36 pm

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
Member
 
Posts: 4
Joined: October 26th, 2006, 3:31 pm

Postby Kambiz » October 28th, 2006, 8:32 am

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
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2424
Joined: March 7th, 2003, 7:10 pm


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron