![]() |
Problem mit MessageDlg
Hi,
in einem meiner Programm "verstecken" sich meine MessageDlgs hinter Form1!!! Wie verhindere ich das? |
Re: Problem mit MessageDlg
Das hatte ich auch schon. Es half, ein BringToFront des aktuellen Forms aufzurufen, bevor Du den MessageDlg anzeigst.
|
Re: Problem mit MessageDlg
Sorry,
hilft nicht.... |
Re: Problem mit MessageDlg
Zeig mal deinen Code, wie du das Fenster wieder in den Vordergrund bringt... Eventuell hilft der hier:
Delphi-Quellcode:
function ForceForegroundWindow(hwnd: THandle; Delay : Integer): Boolean;
const SPI_GETFOREGROUNDLOCKTIMEOUT = $2000; SPI_SETFOREGROUNDLOCKTIMEOUT = $2001; var ForegroundThreadID: DWORD; ThisThreadID: DWORD; timeout: DWORD; begin if delay <> 0 then sleep(delay); if IsIconic(hwnd) then ShowWindow(hwnd, SW_RESTORE); if GetForegroundWindow = hwnd then Result := True else begin if ((Win32Platform = VER_PLATFORM_WIN32_NT) and (Win32MajorVersion > 4)) or ((Win32Platform = VER_PLATFORM_WIN32_WINDOWS) and ((Win32MajorVersion > 4) or ((Win32MajorVersion = 4) and (Win32MinorVersion > 0)))) then begin Result := False; ForegroundThreadID := GetWindowThreadProcessID(GetForegroundWindow, nil); ThisThreadID := GetWindowThreadPRocessId(hwnd, nil); if AttachThreadInput(ThisThreadID, ForegroundThreadID, True) then begin BringWindowToTop(hwnd); SetForegroundWindow(hwnd); AttachThreadInput(ThisThreadID, ForegroundThreadID, False); Result := (GetForegroundWindow = hwnd); end; if not Result then begin SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, @timeout, 0); SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, TObject(0), SPIF_SENDCHANGE); BringWindowToTop(hwnd); SetForegroundWindow(hWnd); SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, TObject(timeout), SPIF_SENDCHANGE); end; end else begin BringWindowToTop(hwnd); SetForegroundWindow(hwnd); end; Result := (GetForegroundWindow = hwnd); end; end; |
Re: Problem mit MessageDlg
Ich weiß nicht ob das jetzt mit den MessageDlg zu tun hat...
Mein Problem ist nicht, dass ich Form1 nicht sehen kann (ich habe keine anderen Forms!), es ist dass aus irgend einem Grund die MessageDlg HINTER und nicht VOR Form1 auftauchen... |
Re: Problem mit MessageDlg
Was passiert denn, wenn du eine MessageBox nimmst?
|
Re: Problem mit MessageDlg
Ich benutzte meistens MessageBox aber ich weiß nicht wie man Knöpfe dabei benutzt.
Meine MessageDlgs (insgesamt drei) sind:
Delphi-Quellcode:
Ich benutzte auch Application.MessageBox , aber nur, wenn ich keine Knöpfe brauche...
MessageDlg('Datei ist nich kompatibel oder enthält Fehler!', mtError, [mbOK], 0);
//mssg = String if MessageDlg(mssg, mtWarning, [mbYes, mbNo], 0) = mrNo then ... if MessageDlg(mssg, mtWarning, [mbYes, mbNo], 0) = mrNo then ... Die MessageBox und auch ein paar ShowMessage werden immer richtig angezeigt (vor der Form) nur die MessageDlg nicht! |
Re: Problem mit MessageDlg
![]() |
Re: Problem mit MessageDlg
OH!!!!
Ich habe nachgeschaut. In der Delphi-Hilfe gibt es zwei Einträge für "MessageBox". Ich habe immer nur eine in Betracht gezogen... Danke, jetzt funnktionierts! PS: Ich konnte meinen Quellentext nicht hergeben a) viel zu lang b) das Programm ist Teil eines Wettbewerbs! |
Re: Problem mit MessageDlg
Kurze Frage: Tritt das nur unter XP auf? Dann könnte es an
![]() |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:33 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz