We have an application that handling our own message – a timered procedure read a database for them.
It it is found a record, then we show a form modally.
This is don’t good solution, because may the user typing, see anything, etc, and the form abort this operation.
I thought that I saw sometimes, that dialogs, windows are detached from the application, and they are seems to be another tasks (the task bar have two elements in this time).
But these things are happens unfrequently, and they are bugs…
But then I want to find a way to cause same thing.
The timer is checking the db, and if it is found a record, then we will show a form in the background, what is seems to be another task, and it is blinking, and it is change it’s caption periodically.
When user is clicking it, it is destroys itself, and show the original “message” form as modally.
Can we do this thing with Win32 tricks?
And how?
Thanks:
dd
Thanks for first answers.
I tried to create a simple example. You can see here:
type
TC = class(TPanel)
private
protected
procedure WMActivate(var Message: TWMActivate); message WM_ACTIVATE;
public
procedure CreateParams(var Params: TCreateParams); override;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
t : TC;
begin
t := TC.Create(Self);
t.Width := 100;
t.Height := 100;
t.Caption := 'aaaa';
ShowWindow(t.Handle, sw_SHOW);
end;
{ TC }
procedure TC.CreateParams(var Params: TCreateParams);
begin
inherited;
Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
Params.WndParent := GetDesktopwindow;
end;
procedure TC.WMActivate(var Message: TWMActivate);
begin
if Message.Active <> WA_INACTIVE
then begin
SHowMessage('b');
SHowWindow(Self.Handle, sw_HIDE);
end;
end;
This is working, but I have one problem.
The icon of the task is same as the application.
If somebody randomly clicked on it, possible clicked on wrong item.
How can redefine the icon of the subwindow?
Thanks:
dd
Not a whole solution, but a piece of the puzzle you’ll probably need: to display a form with its own taskbar button you can override CreateParams