I am not sure about CEP UI, but I know that in ScriptUI it can be listened to using the (Window.show() == 2) condition.
How are you calling the Modal Dialog?
can you provide any samples for me to play with?
My extension is based on the samples in the CEP github that adobe provides: GitHub - Adobe-CEP/Samples: Samples for Adobe Common Extensibility Platform (CEP)
Actually, there is no way to achieve that right now. Unfortunately!
It was not possible in CS, and this has not been fixed in CC.
I was not sure if you were talking about a manifest spawned dialog or if it was one you created with jQuery or something.
a shame to here there is not access to it.
you could add an invisible button over the X to hijack it using something like AHK, but if it need to be cross platform that would not help.