• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 375
  • Last Modified:

Is there a safe way to end a modal dialog from another thread?

Hi,

Is there a safe and simple way to end a modal dialog from another thread in MFC/Win32?  I want to be able to force a modal dialog to close from elsewhere but just calling EndDialog() on it sometimes results in an Access Exception.

Thanks,
Chris
0
chrispauljarram
Asked:
chrispauljarram
1 Solution
 
pgnatyukCommented:
Yes. Send WM_CLOSE to this dialog. For example:
PostMessage(hDlg, WM_CLOSE, 0, 0);
where hDlg is the dialog window handle.
I hope this thread knows how to find the dialog.
 
0
 
chrispauljarramAuthor Commented:
Cheers, that's fine :)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now