win32 interface: fixed focus after restoring a minimized window (bug #7946)

git-svn-id: trunk@10340 -
This commit is contained in:
vincents 2006-12-17 12:33:15 +00:00
parent c0f7e52665
commit 9bb80433b3

View File

@ -736,39 +736,41 @@ Var
SC_MINIMIZE:
begin
if (Application <> nil) and (lWinControl <> nil)
and (Application.MainForm <> nil)
and (Application.MainForm = lWinControl) then
Window := TWin32WidgetSet(WidgetSet).AppHandle;
if Window = TWin32WidgetSet(WidgetSet).AppHandle then
Window := TWin32WidgetSet(WidgetSet).AppHandle;//redirection
if (Window = TWin32WidgetSet(WidgetSet).AppHandle)
and (Application <> nil)
and (Application.MainForm<>nil) then
begin
if (Application <> nil) and (Application.MainForm <> nil) and
Application.MainForm.HandleAllocated then
begin
//DebugLn('SC_MINIMIZE');
Application.IntfAppMinimize;
Windows.SetWindowPos(Window, HWND_TOP,
Application.MainForm.Left, Application.MainForm.Top,
Application.MainForm.Width, 0, SWP_NOACTIVATE);
{$ifdef NO_TRIM_MEMORY}
{Do not trim working set of application in memory
according to: http://support.microsoft.com/kb/293215.
Useful for real-time I/O applications}
Windows.ShowWindow(Window, SW_SHOWMINIMIZED);
exit;
{$endif}
end;
if Application.MainForm.HandleAllocated then
Windows.ShowWindow(Application.MainForm.Handle,SW_HIDE);
Application.IntfAppMinimize;
end;
end;
SC_RESTORE:
begin
if (Window = TWin32WidgetSet(WidgetSet).AppHandle)
and (Application <> nil) then
if (Window = TWin32WidgetSet(WidgetSet).AppHandle)
and (Application <> nil)
and (Application.MainForm<>nil)
and Application.MainForm.HandleAllocated then
begin
//DebugLn('SC_RESTORE');
PLMsg^.Result := Windows.DefWindowProc(Window, WM_SYSCOMMAND, WParam, LParam);
Windows.ShowWindow(Application.MainForm.Handle,SW_SHOW);
if Windows.IsWindowEnabled(Application.MainForm.Handle)
then Windows.SetActiveWindow(Application.MainForm.Handle);
WinProcess := false;
Application.IntfAppRestore;
if Application.MainForm.WindowState = wsMaximized then
Windows.ShowWindow(Application.MainForm.Handle, SW_MAXIMIZE);
end;
end;
end;