浏览代码

BrowseFunc: Don't use Application.Handle.

The DisableTaskWindows call was the problem.

Jordan Russell 9 月之前
父节点
当前提交
f1d03c262a
共有 1 个文件被更改,包括 2 次插入8 次删除
  1. 2 8
      Components/BrowseFunc.pas

+ 2 - 8
Components/BrowseFunc.pas

@@ -86,16 +86,13 @@ begin
       Pointer(lParam) := PChar(InitialDir);
   end;
   ActiveWindow := GetActiveWindow;
-  WindowList := DisableTaskWindows(0);
+  WindowList := DisableTaskWindows(ParentWnd);
   CoInitialize(nil);
   try
     IDList := SHBrowseForFolder(BrowseInfo);
   finally
     CoUninitialize();
     EnableTaskWindows(WindowList);
-    { SetActiveWindow(Application.Handle) is needed or else the focus doesn't
-      properly return to ActiveWindow }
-    SetActiveWindow(Application.Handle);
     SetActiveWindow(ActiveWindow);
   end;
   try
@@ -169,7 +166,7 @@ begin
   ofn.lpstrDefExt := Pointer(DefaultExtension);
 
   ActiveWindow := GetActiveWindow;
-  WindowList := DisableTaskWindows(0);
+  WindowList := DisableTaskWindows(ParentWnd);
   try
     asm
       // Avoid FPU control word change in NETRAP.dll, NETAPI32.dll, etc
@@ -198,9 +195,6 @@ begin
     end;
   finally
     EnableTaskWindows(WindowList);
-    { SetActiveWindow(Application.Handle) is needed or else the focus doesn't
-      properly return to ActiveWindow }
-    SetActiveWindow(Application.Handle);
     SetActiveWindow(ActiveWindow);
   end;
 end;