Problems in Showmodal after assigning Setparent (..)

I created two applications, MainApps and SubApps, SubApps has a modal type dialog box, such as a login / logout form, etc. and its performance.

After I attach it to MainApps, the Modal Dialog dialog box looks like a regular window shape. It behaves like "DIALOG.SHOW" instead of "DIALOG.SHOWMODAL";

I am using the delphi compiler

Button SubApps buttonclick;

  begin
    with TfrmDialog.Create(Self, dtLogout) do
    try
      iMsgResult := ShowModal;
    finally
      Free;
    end;
    if iMsgResult = mrOk then
    begin
      dmVoca.FHomeworkXMLDoc.Active := False;
      //Disabled Double Login
      dmVoca.tmrDoubleLogin.Enabled := False;
      ................
    end;  
  end;

MainApps ButtonClick

begin
setparent(findwindow(nil,'SubApps'),TabSheet1.Handle);
.........
end;
+3
source share
2 answers

, . ShowModal , , . , , . . DisableTaskWindows forms.pas, , ShowModal.

; , , , , .

, -, , , f.i., , ?


: - , MainApps. , , MainFormOnTaskbar - true. . msdn.
var
  frmDialog: TfrmDialog;
begin
  [...]
  frmDialog := TfrmDialog.Create(Self, dtLogout);
  try
    SetWindowLong(frmDialog.Handle, GWL_HWNDPARENT, GetAncestor(Handle, GA_ROOT));
    iMsgResult := frmDialog.ShowModal;
    [...]


, , , , SubApps dll... , ...

+6

" " " ". , , . , . , " ".

+2

Source: https://habr.com/ru/post/1750110/


All Articles