Skip to content

Instantly share code, notes, and snippets.

@jpluimers
Created April 6, 2015 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpluimers/b6edd5c287e75bd98f69 to your computer and use it in GitHub Desktop.
Save jpluimers/b6edd5c287e75bd98f69 to your computer and use it in GitHub Desktop.
Windows 7 hangs with common dialogs when COM is not initialised correctly
try
LDialogEvents := TFileDialogEvents.Create(Self);
Advise(LDialogEvents, LAdviseCookie);
try
Result := Succeeded(Show(ParentWnd)); //// <---- hangs here
if Result then
Result := Succeeded(GetResults);
finally
Unadvise(LAdviseCookie);
end;
finally
EnableTaskWindows(LWindowList);
SetActiveWindow(ParentWnd);
RestoreFocusState(LFocusState);
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment