I am running a Delphi app as a seamless remote app. I am sure that I have read in the past that VCL applications create a 0x0 hidden window as well as the main application window. I think it is related to the TApplication object. If this is the case, it would explain why I have two windows showing on the task bar each time I run this app.

I am running a Delphi app as a seamless remote app. I am sure that I have read in the past that VCL applications create a 0x0 hidden window as well as the main application window. I think it is related to the TApplication object. If this is the case, it would explain why I have two windows showing on the task bar each time I run this app.

One shows, as it should do the app name. The other just shows (remote) with no other name and there are only two options available (minimise and close). Closing it closes the main app, so I am sure that they are related.

Is there any way to prevent this and only show the main application window?

Comments

  1. Nope, doesn't happen here. Try some very basic debugging. Create a brand new VCL app. See how it behaves. Does it behave the same? If not then you know to look at your own code to find the difference.

    ReplyDelete
  2. Martyn Spencer How does the begin/end block of your .dpr file look?

    ReplyDelete
  3. Thanks for your initial suggestions. Interestingly enough, this only happens on Windows 7. Windows 10 appears to manage just fine. The app was written using XE3. I have XE10 available but do not wish to move over to it just yet.

    The project file is:

      Application.Initialize;
      if AppInstance.ThisInstanceRequired then begin
        Application.MainFormOnTaskbar := True;
        Application.CreateForm(TfMain, fMain);
        Application.Run;
      end;

    I have to use MainFormOnTaskBar as I found that when I didn't, certain windows messages were not being sent to the app, if I recall correctly.

    ReplyDelete
  4. Martyn Spencer Try moving MainFormOnTaskbar after CreateForm?

    ReplyDelete
  5. In such situations I run InqSoft Window Scanner, and inspect the list of windows that app creates.

    ReplyDelete
  6. I agree with David Heffernan try with a brand new app to see if it reproduces. Then diff the app with your own app.

    ReplyDelete
  7. Will try with a brand new VCL app to compare.

    One point that was not clear in my initial post was that running the app locally only shows one window int the task bar, as expected. This is when running as a seamless remote app.

    ReplyDelete
  8. Does the App have DDE or OLE support?

    ReplyDelete
  9. No DDE or OLE support.

    It is the ShowMainFormOnTaskbar := True that causes this behaviour. Later versions of Windows seem to hide the window on the taskbar but Windows 7 does not.

    Anyone know of a way of handling this?

    ReplyDelete
  10. I am trying to achieve a situation where the main form is on the taskbar (as other things don't work if it is not) and there is only one icon showing. This could simply be a Win7 limitation and your comment seems to confirm this.

    ReplyDelete
  11. We've been around this so many times. Don't make the desktop be the owner of your window. There's just so much misinformation in that post I don't know where to begin.

    ReplyDelete
  12. Let's turn it around. If you bullet point how you run your app I'll try it with some projects i got that uses the taskbar in different ways. Could perhaps reveal something.

    ReplyDelete
  13. I think it is just a "feature" of how Windows 7 shows the app. I have tried a very basic single blank form app and set MainFormOnTaskbar to True (code pasted above).

    The RD session shows the "hidden" form and the main form as two icons. Set it to false, only one window is shown. As for side-effects, setting it to false breaks a few things so is not an option.

    So, all I am interested in is if we take this basic app, set MainFormOnTaskbar to true, can Windows 7 be forced to show only one icon on the task bar when running the app in a remote desktop session. Comments above imply that this cannot be done. If there is a way, I would be happy to know. Otherwise, I think it is something that I have to live with.

    ReplyDelete
  14. Did you try moving that setting to after the main form create? I had a similar problem and I think that was the cure for me. I had many forms created, though.

    ReplyDelete
  15. Yes, thanks. I tried that and it made no difference.

    ReplyDelete
  16. Do a ShowWindow(Application.Handle, SW_Hide) (not tested code) on main form activation.

    ReplyDelete
  17. Use spy++ to identify this window. Then diagnose why it is appearing on the taskbar. So much easier to solve problems if you don't rely on guesswork.

    ReplyDelete

Post a Comment