2

I am writing an application in Delphi 2013 for windows 7 64-bit.

I have a form which opens a new form with ShowModal().
When this new form is being created the FormCreate contains the following code:

SetWindowLong(Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
BorderStyle := bsSingle;

My problem with this code is that the caption also disappears.
How can I hide the new form from the task bar without hiding the form caption?

Jan Doggen
  • 8,799
  • 13
  • 70
  • 144
  • 4
    What is 'Delphi 2013'? – Andreas Rejbrand Jul 30 '13 at 13:46
  • 1
    This code does not do what you say it does. Is this VCL or FMX? Also, Andreas's question is valid; what is 'Delphi 2013'? – J... Jul 30 '13 at 13:51
  • 1
    The way to remove a form from the task bar is to make it be owned (and I mean the Windows definition of ownership) by another window. Typically that would be the main form. That all happens automatically, so this question makes no sense. In other words, a plain vanilla modal form will not result in a button appearing on the task bar. Please provide enough detail for us to understand why you don't see that. – David Heffernan Jul 30 '13 at 13:59
  • 1
    Now the principal reason why you saw strange behaviour is that you removed all extended styles from the window. What you meant to do was use bitwise OR between the existing extended styles, and `WS_EX_TOOLWINDOW`. But doing it that way is hopeless too because of window re-creation. In the VCL, window styles, extended styles need to be specified in CreateParams. I expect that you simply remove the call to `SetWindowLong` and all is well. – David Heffernan Jul 30 '13 at 14:01
  • @Andreas i think he means Delphi Xe³ or 4 – Hidden Jul 30 '13 at 14:39
  • http://stackoverflow.com/questions/14811935/how-to-hide-an-application-from-taskbar-in-windows-7 – Hidden Jul 30 '13 at 14:41
  • I'm sorry, I ment Delphi XE3, I am using VCL, I create the form from java (using JNI). I have a function that call setWindowLong(Form.Handle, GWL_EXSTYLE, GetWindowLong(Form.Handle, GWL_EXSTYLE) or WS_EX_TOOL_WINDOW) When I call this function Form disappear from taskbar but the caption also disappear – Eran Friedland Jul 31 '13 at 10:51
  • David, I have also tried to use the CreateParams procedure but I got the same effect, the form's caption disappeared – Eran Friedland Jul 31 '13 at 12:45

0 Answers0