0

I have a Windows VCL application written in C++Builder. Some of the UI is implemented inside a DLL rather than directly in the main EXE.

The DLL exports a function that creates and shows a VCL form, something like:

extern "C" __declspec(dllexport)
void __stdcall show_plugin_form()
{
  auto *f(new TPluginForm(nullptr));
  f->Show();
}

Owner is intentionally nullptr because the form is created inside a DLL and I don't want it auto-destroyed by the EXE's main form.

The form displays correctly and behaves normally until I minimise it. As soon as it is minimised:

  • the form does not appear on the taskbar;
  • it also doesn't appear in the Alt+Tab list.

It seems to vanish, even though the process is still running. It becomes impossible to restore unless I explicitly call f->Show().

I checked common properties:

  • FormStyle = fsNormal;
  • BorderIcons includes biSystemMenu and biMinimize;
  • BorderStyle is sizeable;
  • WindowState = wsNormal.

1 Answer 1

1

This is expected behaviour for ownerless forms created in DLLs (a VCL form inside a DLL has no real taskbar owner).

Starting from C++Builder Athens (RAD Studio 12) the fix, based on the ShowInTaskBar property, is simple, add:

ShowInTaskBar = true;

in the form constructor.

Older versions of C++Builder have no ShowInTaskBar property, so you have to use the Windows API directly:

{
  // ...
  auto exStyle(GetWindowLong(Handle, GWL_EXSTYLE));
  exStyle |= WS_EX_APPWINDOW;  // force taskbar visibility
  SetWindowLong(Handle, GWL_EXSTYLE, exStyle);
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.