Commit 6bb3d980 authored by wassim's avatar wassim
Browse files

Fix for bug #32366 (TForm.ShowModal on WinCE loops itself). Patch by Lacak

git-svn-id: trunk@58432 -
parent a85f9e5e
......@@ -405,13 +405,37 @@ end;
class procedure TWinCEWSCustomForm.SetShowInTaskbar(const AForm: TCustomForm;
const AValue: TShowInTaskbar);
var
OldStyle, NewStyle: DWord;
Visible, Active: Boolean;
begin
if not WSCheckHandleAllocated(AForm, 'SetShowInTaskbar') then
Exit;
if (Application <> nil) and (AForm = Application.MainForm) then
if Assigned(Application) and (AForm = Application.MainForm) then
Exit;
RecreateWnd(AForm);
OldStyle := GetWindowLong(AForm.Handle, GWL_EXSTYLE);
if AValue = stAlways then
NewStyle := OldStyle or WS_EX_APPWINDOW
else
NewStyle := OldStyle and not WS_EX_APPWINDOW;
if OldStyle = NewStyle then exit;
// to apply this changes we need either to hide window or recreate it. Hide is
// less difficult
Visible := IsWindowVisible(AForm.Handle);
Active := GetForegroundWindow = AForm.Handle;
if Visible then
ShowWindow(AForm.Handle, SW_HIDE);
SetWindowLong(AForm.Handle, GWL_EXSTYLE, NewStyle);
// now we need to restore window visibility with saving focus
if Visible then
if Active then
ShowWindow(AForm.Handle, SW_SHOW)
else
ShowWindow(AForm.Handle, SW_SHOWNA);
end;
class procedure TWinCEWSCustomForm.ShowModal(const ACustomForm: TCustomForm);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment