c++ - How to return positive error code from ATL to VB6? -
i have checked out answer at: how can return both error string , error code vb6 atl activex control?
i able return custom negative error codes, ie severity bit set, , custom error message. but, able generate code vb6 present positive # err.number user find easier use. i'm pretty sure can done since microsoft's dao 3.6 dll able to. example, returns err.number= 3078 err.description "the microsoft jet database..." if table not exist.
note have implemented isupporterrorinfo, etc. error reporting.
annotating mark's answer bit. he's right using facility_control. in addition must ensure error code larger 512 doesn't interfere vb6 runtime error codes. use this:
hresult makevb6error(uint errcode) { assert(errcode > 0 && errcode < 65536 - 513); return make_hresult(severity_error, facility_control, errcode + 513); }
Comments
Post a Comment