If the Registry class shown below throws an exception, I get Windows error "Unhandled Exception.". I though my catch block would get executed.
Code:class CRegistry { public: CRegistry() { if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, base, 0, KEY_ALL_ACCESS, &hkey_) != ERROR_SUCCESS) { // Can't open the registry key, so throw an exception. throw; // Lines beyone here are never executed. } } // remainder of class not shown }; int main() { try { Registry reg("Software\\COE\\Software\\GTSAIT"); } catch(...) { AfxMessageBox("Exception caught"); } }




Reply With Quote