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;