DelphiCool
asked on
WM_ACTIVATE ???
Hi,
I want to use this code to always set my windows activate, but it doesn't work???
...
Private
Procedure ToujoursActif(var Msg :TMessage);
message WM_ACTIVATE;
...
Procedure TMainForm.ToujoursActif(va r Msg :TMessage);
begin
if Msg.WParam = WA_INACTIVE then SendMessage(handle, WM_ACTIVATE, WA_ACTIVE,0);
end;
logicaly, this code work, cause if i put SendMessage(handle, WM_ACTIVATE, WA_ACTIVE,0); in a button, it's ok
I want to use this code to always set my windows activate, but it doesn't work???
...
Private
Procedure ToujoursActif(var Msg :TMessage);
message WM_ACTIVATE;
...
Procedure TMainForm.ToujoursActif(va
begin
if Msg.WParam = WA_INACTIVE then SendMessage(handle, WM_ACTIVATE, WA_ACTIVE,0);
end;
logicaly, this code work, cause if i put SendMessage(handle, WM_ACTIVATE, WA_ACTIVE,0); in a button, it's ok
ASKER
It doesn't work inthe
The form isn't bringged to top
I try your code and add
setforegroundwindow(handle );
BringWindowToTop(handle);
but no way
Why did you prefer procedure WMActivate( Var msg: TWMActivate );
instead of Procedure ToujoursActif(var Msg :TMessage);
to work only with WM_activate message ??
The form isn't bringged to top
I try your code and add
setforegroundwindow(handle
BringWindowToTop(handle);
but no way
Why did you prefer procedure WMActivate( Var msg: TWMActivate );
instead of Procedure ToujoursActif(var Msg :TMessage);
to work only with WM_activate message ??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks inthe
you get the points
It's bizare, when I click on another window, my programme is bring to top, but if i click another time on the other window, my prog doesn't came on top
PS I'm using windows ME
Thanks
you get the points
It's bizare, when I click on another window, my programme is bring to top, but if i click another time on the other window, my prog doesn't came on top
PS I'm using windows ME
Thanks
yeh i noticed that also.
there are other ways around this but they can get long and messy.i guess thats why they made this new api AllowSetFor..() , the way ms made all the windows versions with a different mechanism for putting a window to top is not good (IMHO :-)
also maybe using modal forms etc and different formstyles (ie FsStayOnTop) can improve what your trying to do.
good luck
Barry
there are other ways around this but they can get long and messy.i guess thats why they made this new api AllowSetFor..() , the way ms made all the windows versions with a different mechanism for putting a window to top is not good (IMHO :-)
also maybe using modal forms etc and different formstyles (ie FsStayOnTop) can improve what your trying to do.
good luck
Barry
use TWMActivate mesage instead,declare it like this:
private
{ Private declarations }
procedure WMActivate( Var msg: TWMActivate );
message WM_ACTIVATE;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.WMActivate( Var msg: TWMActivate );
begin
If msg.Active = WA_INACTIVE Then
PostMessage(handle, WM_ACTIVATE, WA_ACTIVE,0);
inherited;
end;
the above will only make the window active and not nessesarily at the top though,so maybe you may want to add setforegroundwindow etc as well.