Questions from the past – Invisible Modal Window

Delphi 2005 and older does suffer from one annoying problem – once in the while your modal dialog will be stuck behind of window it suppose to be modal to.

It is very “funny” when someone trying to click on main application window and it does not get focus (most likely you are using Windows XP). Magic wand? yes! Alt+TAB to switch off the application and then Alt+TAB to come back and reactivate it. Ah! you have modal dialog sitting behind, which off cause require you to click a button and keeping everything else waiting. Try to explain this to some of your customers… sometimes you might see very funny faces.

Inconvenience? yes. Is there a way around it? yes. It was fixed since Delphi 2006. Upgrade!!!!
Is not justifiable? Then call few lines of code on start-up of your application.

procedure DisableProcessWindowsGhosting;
var
  DisableProcessWindowsGhostingProc: procedure;
begin
  DisableProcessWindowsGhostingProc := GetProcAddress(
    GetModuleHandle('user32.dll'),
    'DisableProcessWindowsGhosting');
  if Assigned(DisableProcessWindowsGhostingProc) then
    DisableProcessWindowsGhostingProc;
end;

More details are provided in this QC entry. Enjoy.

This entry was posted in Delphi. Bookmark the permalink.

Leave a Reply

  • About

    From being a junior developer all the way to Development Manager position, I was always interested in new technologies. Passionate speaker, IT junky, developer, architect, team lead, and development manager - many hats, one goal - making software better and closer to people’s needs. For the most part I am using my blog as a scratch pad, writing small articles on things which I came across, was asked about more then once, and which would otherwise require additional research again and again.

    View Serguei Dosyukov's profile on LinkedIn
  • Testimonials

    The greydragon theme is fantastic. It’s clean, stable and feature rich. It took me a while to decide to move...

    Ed

    I've been using this [theme] since the start. It is by far the most attractive, feature packed and stable of...

    Rhyull

    I’m a huge fan of this theme. I’ve got more than 90,000 pictures in my gallery3 running on a Ubuntu...

    Jklobo

    more...

  • Categories