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);
OldStyle, NewStyle: DWord;
Visible, Active: Boolean;
if not WSCheckHandleAllocated(AForm, 'SetShowInTaskbar') then
if (Application <> nil) and (AForm = Application.MainForm) then
if Assigned(Application) and (AForm = Application.MainForm) then
OldStyle := GetWindowLong(AForm.Handle, GWL_EXSTYLE);
if AValue = stAlways then
NewStyle := OldStyle or WS_EX_APPWINDOW
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)
ShowWindow(AForm.Handle, SW_SHOWNA);
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