c - what to return or to do in a winapi window procedure in order to intercept an error and produce an error log entry -
we have c program.
1 policy in development of program is:
"every function/method can fail should have return value , should
return appropriate value in case of error. no exception behaviour."
so, in case of error, our program produces cascading error report, because every function returns error flag.
my problem window procedure.
in c winapi process button click event (wm_command signal)
in separate function. if there error, make error log entry , return 0.
in window procedure, called function, if function returns 0, produce error log entry and, now, value should return window procedure in order achieve it, chain of error logs , error return values not break?
i understand stackoverflow post: how indicate errors in handling messages in window procedures?
that windows not care error.
i know wm_create
signal other rest.
but want send appropriate return value. 0?
msdn not me: https://msdn.microsoft.com/en-us/library/windows/desktop/ms633573(v=vs.85).aspx
"the return value result of message processing , depends on message sent."
thanks lot in advance
you can apply policy functions prototypes in control. window procedure out of control. meaning of return value not determined you. windows api determines that, , in way not compatible policy.
you have accept policy cannot applied here. in case of wm_command
window procedure cannot cascade error because caller, win32 framework, doesn't follow policy. best can log error , return window procedure value stipulated documentation. in case 0 since handled message.
Comments
Post a Comment