Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 11-10-2005, 07:33 AM
digitiger digitiger is offline
Senior Member
 
Join Date: Jan 2001
Posts: 716
Default problem with WmSyscommand

I am using a WmSyscommand procedure in the main form of a Delphi application. It has been declared as a private method in main form. Its stripped down version is as below

private
{ Private declarations }
....
procedure WMSysCommand
(var Msg:TWMSysCommand);
message WM_SYSCOMMAND;

....
.....


procedure TMainForm.WMSysCommand(var Msg: TWMSysCommand); //SKA:2005-11-09
begin
DefaultHandler(msg);// Let windows default event handler
// do the needful
inherited
end;


most of the time it is working fine except if the application is minimized to the task bar and then user clicks on the application window/icon on the task bar. By default if a user clicks on the window/icon of a minimized application (on task bar) then the application should get maximized/restored but in my case the application just becomes a small box on the lower left corner of the desktop just like a minimized mdi child form in an mdi application.

If I remove this WmSyscommand procedure then it application works fine. can some one please help me

Thanks a lot in advance
Reply With Quote
  #2  
Old 11-10-2005, 08:13 AM
BaraoZemo BaraoZemo is offline
Senior Member
 
Join Date: Nov 2001
Posts: 3,598
Default RE: problem with WmSyscommand

i wrote some changes based in these examples
[link]http://delphi.about.com/cs/adptips1999/a/bltip0999_4.htm[/link]
[link]
http://delphi.about.com/cs/adptips1999/a/bltip0999_4.htm
[/link]


Code:
procedure TMainForm.WMSysCommand;
begin
{ identify some events and fire the code that you want
for example identify minimize or maxime and beep the app }

   if (Msg.CmdType = SC_MINIMIZE) or
      (Msg.CmdType = SC_MAXIMIZE) then
   begin
   MessageBeep(0); //make a sound to test.. beep!
   DefaultHandler(Msg) ;
   end
else
   inherited;

end;


Regards
BaraoZemo

ps, don't forget to click in the button and Accept as Answer if this helped you!
Reply With Quote
  #3  
Old 11-21-2005, 04:29 AM
BaraoZemo BaraoZemo is offline
Senior Member
 
Join Date: Nov 2001
Posts: 3,598
Default RE: problem with WmSyscommand

hi.

please, dont forget to choice the best answer and close the topic accepting the correct answer

Regards
BaraoZemo

ps, don't forget to click in the button and Accept as Answer if this helped you!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 07:32 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.