AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein GUI-Design mit VCL / FireMonkey / Common Controls Delphi Maximiertes Fenster wird von der Taskleiste verdeckt (mit Lösung)
Thema durchsuchen
Ansicht
Themen-Optionen

Maximiertes Fenster wird von der Taskleiste verdeckt (mit Lösung)

Ein Thema von bernau · begonnen am 28. Feb 2018 · letzter Beitrag vom 28. Feb 2018
 
EWeiss
(Gast)

n/a Beiträge
 
#6

AW: Maximiertes Fenster wird von der Taskleiste verdeckt (mit Lösung)

  Alt 28. Feb 2018, 17:50
Zitat:
Nun schiebt sich das maximierte Fenster hinter die Taskleiste.
Dafür gibt es doch die API SetForegroundWindow
Bin nicht ganz sicher, wie es momentan ist, aber früher war die einzige Möglichkeit ein Fenster vor die Taskleiste zu bekommen per fsStayOnTop . MSDN-Library durchsuchenSetForegroundWindow hatte da nicht ausgereicht.
Du hast natürlich recht ein HWND_TOPMOST ist noch von nöten.

Meine FullScreen Funktion.

Delphi-Quellcode:
procedure ToogleFullScreen;
var
  wP: WINDOWPLACEMENT;
  hMon: HMONITOR;
  tmi: MONITORINFO;
  rw: TRect;
begin

  FullScreen := not FullScreen;

  ZeroMemory(@wP, sizeof(wP));
  if (GetWindowPlacement(gP.MainHandle, wP)) then
    if (wP.showCmd = SW_SHOWMAXIMIZED) then
      SendMessage(gP.MainHandle, WM_COMMAND, ID_RESTORE, 0);

  if FullScreen then
  begin
    if (gP.PanelHandle <> 0) then
      DestroyWindow(gP.PanelHandle);

    gP.PanelHandle := CreatePanel(gP.MainHandle);

    ShowWindow(BackVisgroundFrame.Handle, SW_HIDE);
    if KVideo_GetPlayerState = psPlaying then
      btnFPlay.Enabled := False;

    GetWindowRgn(gP.MainHandle, oldRgn);
    GetWindowRect(gP.MainHandle, rcSaved);

    SetWindowPos(gP.MainHandle, HWND_TOPMOST, 0, 0, 0, 0,
      SWP_NOMOVE or SWP_NOSIZE or SWP_FRAMECHANGED or SWP_SHOWWINDOW); // Topmost

    hMon := MonitorFromWindow(gP.MainHandle, MONITOR_DEFAULTTONEAREST);
    ZeroMemory(@tmi, sizeof(tmi));

    tmi.cbSize := sizeof(tmi);
    GetWindowRect(gP.MainHandle, rw);
    GetMonitorInfo(hMon, @tmi);

    screenWidth := abs(tmi.rcMonitor.Right - tmi.rcMonitor.Left);
    screenHeight := abs(tmi.rcMonitor.Bottom - tmi.rcMonitor.Top);

    rw.left := tmi.rcMonitor.left;
    rw.top := tmi.rcMonitor.top;
    rw.right := screenWidth;
    rw.bottom := screenHeight + 94;
    MoveWindow(gP.MainHandle, rw.left, rw.top, rw.right, rw.bottom, TRUE);

    // Videowindow
    GetWindowRect(MovieHandle, rcVideo);
    VideoSizeChanged := true;
    MoveWindow(MovieHandle, 0, 0, screenWidth, screenHeight, TRUE);

    newRgn := CreateRectRgn(0, 0 , screenWidth, screenHeight);
    if (newRgn <> 0) then
      SetFocus(MovieHandle);

    if (gP.PanelHandle <> 0) then
    begin
      gP.PanelEffect := GetTickCount + ALPHA_LENGTH;

      trbFullScreen.SetTrackMinMax(trbFullScreen.Handle, 0, integer
        (aMediaProperty.PlaybackLength div 10000));

      ShowWindow(gP.PanelHandle, SW_SHOW);
    end;
  end else
  begin
    if (gP.PanelHandle <> 0) then
    begin
      Show_Cursor();
      gP.PanelEffect := 0;
      DestroyWindow(gP.PanelHandle);
    end;

    // Videowindow
    if (VideoSizeChanged) then
    begin
      VideoSizeChanged := False;
      MoveWindow(MovieHandle, rcVideo.Left, rcVideo.Top, rcVideo.Right, rcVideo.Bottom, true);
    end;

    screenWidth := rcSaved.Right - rcSaved.Left;
    screenHeight := rcSaved.Bottom - rcSaved.Top;
    SetWindowRgn(gP.MainHandle, oldRgn, False);

    SetWindowPos(gP.MainHandle, HWND_NOTOPMOST, rcSaved.Left, rcSaved.Top, screenWidth,
      screenHeight, SWP_SHOWWINDOW);

    if (oldRgn <> 0) then
      SetWindowRgn(gP.MainHandle, oldRgn, TRUE);

    if (newRgn <> 0) then
      DeleteObject(newRgn);

    PostMessage(gP.MainHandle, WM_SIZE, 0, MAKELONG(screenWidth, screenHeight));
    ShowWindow(BackVisgroundFrame.Handle, SW_SHOW);
  end;
  KVideo_Resize;
end;
gruss

Geändert von EWeiss (28. Feb 2018 um 17:57 Uhr)
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:13 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 by Thomas Breitkreuz