delphi - Delphi7: TBitmap.Canvas.Handle = 0 -
i facing problem long time, , have not found me solve it. use tbitmap receive data coming camera (stream) , save image disk. exception occurs. after several tests found flaw: handle property of tbitmap's canvas value 0. bypass problem, when detect value 0 in handle, restart application (destroy , recreate tbitmap did not work), error occurs frequently. has had problem this? doing wrong? welcome. thank you.
tbitmap internally uses tbitmapcanvas wrapper object tbitmap.canvas. if have access source (graphics.pas) should have look. chances 1 or more winapi gdi calls don't handle return value in case of error. gdi calls have slim chance of failing, it's of gamble leave out checking each , every returned value gain bit of performance, in cases of high load these may first indicators things go wrong anyway.
i suggest try use debug dcu's step through program using tbitmap.canvas, list gdi calls used make things work, code these operations checking returned values , handling errors correctly. should enable find out more going on when connection camera failing, , decrease of overhead have using tbitmap.
Comments
Post a Comment