Close a TCommonDialog automatically

It is possible to close a common dialog shown by TCommonDialog.Execute
(or its overriddens) method while it is visible and application handles messages.
The solution is:

SendMessage(GetParent(OpenDialog1.Handle), WM_SYSCOMMAND, SC_CLOSE, 0);