#3 error-message improvement

open
nobody
None
5
2003-10-03
2003-10-03
Hans-Dieter Karl
No

the EComPort Error simply ignores the information
provided by the windows-error-number (and sometimes
this can be a useful information)

so i changed EComPort.create to

*****

constructor EComPort.Create(ACode: Integer;
AWinCode: Integer);
var Buffer: array [0..1023] of char;
SysErrorMsg: String;
begin // changed by hdk !
FWinCode := AWinCode;
FCode := ACode;
SetString(SysErrorMsg, Buffer, FormatMessage(
FORMAT_MESSAGE_FROM_SYSTEM,
nil, AWinCode, 0, Buffer, sizeof(Buffer), nil) );
inherited CreateFmt(ComErrorMessages[ACode] + _('
(win error code: %d)') +
#13#10 + SysErrorMsg, [AWinCode]);
end;

*****

to see, what M$ has to say ;)

Discussion