views:

507

answers:

1

I have a modal dialog that is created with the following:

procedure TFormCompose.createParams(var Params: TCreateParams);
begin
     inherited createParams(Params);
     with Params do begin
          exStyle:=exStyle or WS_EX_APPWINDOW;
          wndParent:=getDesktopWindow;
     end;
end;

In this form, I create an instance of TOpenDialog. When it opens, it sends my first modal dialog behind the main application window.

Is there a way to get the TOpenDialog to open without affecting the Z order of the modal dialog?

Thanks!

+5  A: 

What version of Delphi are you using? Delphi 2007 and up add an overloaded TOpenDialog.Execute(ParentWnd: HWND); passing the handle of your modal dialog as the ParentWnd when calling Execute() may help.

For future reference, make sure you specify which version of Delphi. Answers appropriate to Delphi 2009, for example, wouldn't be of much use to you if you were using Delphi 5, and would be a waste of time for the person providing the answer.

Ken White
Delphi 2007. Thanks for pointing that out!
Bill Seven
You're welcome. :-)
Ken White