zmiana trybu ShowModal

0

Witam,
Czy jest możliwa zamiana trybu wyświetlania okna modalnego na okno normalne z wykorzystaniem funkcji API?

0
stan24 napisał(a)

Witam,
Czy jest możliwa zamiana trybu wyświetlania okna modalnego na okno normalne z wykorzystaniem funkcji API?

E.... Nie rozumiem... Do normalnego pokazania okna służy Show.

0

Chcę zmienić atrybuty wyświetlaniego okna dialogowego. Funkcja GetWindowLong dla parametów GWL_EXSTYLE i GWL_STYLE zwraca mi takie same wartości dla okna otwartego za pomocą funkcji Show i ShowModal. Wynoszą one odpowiednio: $16CF0000 i $10100.
Więc teraz myślę, że teraz rozumiesz moje pytanie

0

ale po co??

0

Problem nie tkwi dlaczego chce to zrobic ale w jaki sposób. Proszę o komentarze i wskazówki na temat.

0

porównaj sobie ...

procedure TCustomForm.Show;
begin
  Visible := True;
  BringToFront;
end;

function TCustomForm.ShowModal: Integer;
var
  WindowList: Pointer;
  SaveFocusCount: Integer;
  SaveCursor: TCursor;
  SaveCount: Integer;
  ActiveWindow: HWnd;
begin
  CancelDrag;
  if Visible or not Enabled or (fsModal in FFormState) or
    (FormStyle = fsMDIChild) then
    raise EInvalidOperation.Create(SCannotShowModal);
  if GetCapture <> 0 then SendMessage(GetCapture, WM_CANCELMODE, 0, 0);
  ReleaseCapture;
  Application.ModalStarted;
  try
  Include(FFormState, fsModal);
  ActiveWindow := GetActiveWindow;
  SaveFocusCount := FocusCount;
  Screen.FSaveFocusedList.Insert(0, Screen.FFocusedForm);
  Screen.FFocusedForm := Self;
  SaveCursor := Screen.Cursor;
  Screen.Cursor := crDefault;
  SaveCount := Screen.FCursorCount;
  WindowList := DisableTaskWindows(0);
  try
    Show;
    try
      SendMessage(Handle, CM_ACTIVATE, 0, 0);
      ModalResult := 0;
      repeat
        Application.HandleMessage;
        if Application.FTerminate then ModalResult := mrCancel else
          if ModalResult <> 0 then CloseModal;
      until ModalResult <> 0;
      Result := ModalResult;
      SendMessage(Handle, CM_DEACTIVATE, 0, 0);
      if GetActiveWindow <> Handle then ActiveWindow := 0;
    finally
      Hide;
    end;
  finally
    if Screen.FCursorCount = SaveCount then
      Screen.Cursor := SaveCursor
    else Screen.Cursor := crDefault;
    EnableTaskWindows(WindowList);
    if Screen.FSaveFocusedList.Count > 0 then
    begin
      Screen.FFocusedForm := Screen.FSaveFocusedList.First;
      Screen.FSaveFocusedList.Remove(Screen.FFocusedForm);
    end else Screen.FFocusedForm := nil;
    if ActiveWindow <> 0 then SetActiveWindow(ActiveWindow);
    FocusCount := SaveFocusCount;
    Exclude(FFormState, fsModal);
  end;
  finally
    Application.ModalFinished;
  end;
end;
0

zalaczam link dla osob ktorych ineresuje rozwiazanie tego problemu:
http://forum.ks-ekspert.pl/index.php?showtopic=104257

temat zamykam

1 użytkowników online, w tym zalogowanych: 0, gości: 1