Anywho, on to the subject. I would like to be able to have
certain windows/components respond to certain obscure messages.
For example, one message that I need to respond to is the
WM_WININICHANGE. Any tips would really be useful.
Been outta Pascal for a lotta years (since Turbo v4.0). I got
seduced by the dark side (c++/asm). Am actually enjoying Pascal.
Scary. Loved C/C++ for a long while, but am really sick of it
lately, like the last four days. Like ever since Delphi. I
don't understand. Scary.
Thanx.
-- Mufti
You just need to do something like this:
--------
type
TMyControl = class(TWinControl)
procedure WMIniChange(var Msg: TWMIniChange); message WM_INICHANGE;
.....
end;
procedure TMyControl.WMIniChange(var Msg: TWMIniChange);
begin
{ do whatever you need. TWMIniChange is a record that has all the }
{ info about the windows message. Oh, and don't forget to call }
{ inherited if you want default behavior. }
end;
-------------
> Been outta Pascal for a lotta years (since Turbo v4.0). I got
> seduced by the dark side (c++/asm). Am actually enjoying Pascal.
> Scary. Loved C/C++ for a long while, but am really sick of it
> lately, like the last four days. Like ever since Delphi. I
> don't understand. Scary.
Well, at last you have seen the error of your ways. Good to have you back.
Brad
--
--------------------------------------------------------
Brad Stowers | bsto...@cybernetics.net
deltaComm Development | My views are my own...
Telix for Windows & DOS | Keep yer hands off of 'em.
--------------------------------------------------------
http://www.cybernetics.net/users/bstowers/
Declaring a method in a TForm will allow you to handle
WM_WININICHANGED messages:
procedure WMWinIniChange(var Message: TMessage);
message WM_WININICHANGE;
The body of the implementation could look like:
procedure TForm1.WMWinIniChange(var Message: TMessage);
begin
inherited;
{.. react to someone mucking with control panel ..}
end;
The call to "inherited" is important. Note also that message
handlers are special when calling their inherited since you
don't refer to the name of the inherited. This is because
the inherited is refering to the inherited message handler for
this message number, which might not have a visible name or
or even the same name as you have given it, or in some cases,
might not even exist (in which case you are really calling
DefaultHandler).
Chuck Jazdzewski (cj...@borland.com)
Delphi Development
GM
Do you always call Inherited? For example, if I handle WM_SYSCOMMAND...
Cheers,
Don
No. If you want to squelch the inherited behavior you shouldn't call
it. It is not that expensive to call inherited so I would call it
event if you are sure the inherited doesn't do anything since it
might in the next release and your control would stop working.