Kovács László wrote: <procedure TForm1.BitBtn1Click(Sender: TObject); Var F:TForm2; begin F:=TForm2.Create(Application); F.Caption:='Ize-bize'; F.ShowModal; F.Free; end;>
Ah, I should have provided more information. Of course your snippet works, but technically the window that appears in the alt-tab list is not the dialog, but the application window (Application.Handle). Now I'm creating an application that must work like MS-word: no longer MDI, even no main form, but an equivalent form for each document. Delphi gives us a hard time doing that, because of that special Application window. What I did is the following: - I don't want a main form, that is, I don't want all other forms to die with a particular main form. I want my app to exit after the last document form is closed, regardless of which one that is. To do that, I did create a main form (because Delphi forces me to), but I gave it the WS_EX_TOOLWINDOW style, so it's not on the taskbar and I put it off-screen (position -100, -100). - All document forms are derives from a base class (TDocForm), which includes the WS_EX_APPWINDOW style, so they are shown on the taskbar. If a document form is closed, it checks if the dummy main form is the only one remaining. If it is, the application is closed. - I included the WS_EX_TOOLWINDOW style for the the Application.Handle, because I don't want it on the task bar (otherwise it would apear along with the documents, which no ordinary end-user would understand). So far so good, but now, if the application activates a modal dialog, I've got two problems: - If I switch to another app with alt-tab, dialog window jumps behind the document window, so after the application is reactivates, it's no longer accessible. Since all other windows are disabled, because of the modal state, to the end-user it seems the application is blocked. I solved this by implementing a message handler for WM_ACTIVATEAPP in the TDocForm. If the application is activated, and the active form is modal (fsModal in FormState), the active form is brought to the front. - During the modal state, no window appears in the in alt-tab list. Normally, the application window would be there, but now it isn't, because it's not on the taskbar. The document forms aren't either, because theyre are disabled and the modal dialog isn't, because it's also not on the taskbar. A possible solution might be to put the dialog on the taskbar, but I can't do this for the dialogs displayed with ShowMessage and related routines. Apart from that, I don't want the dialog to appear on the taskbar, but only in the in the alt-tab list. It must be possible some way, because MS-word does it too. Anybody went the path before? Peter Laman Senior Software Engineer Lance ICT Group Roermond, the Netherlands http://www.lance-safety.com - "Nobody ever died of hard work", they say. But why take the risk? (Ronald Reagan) __________________________________________________ Delphi-Talk mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi-talk
