Delphi XE2, vcl styles recreating window handle -
after applying new style @ runtime mainform of application creates new window handle – there way stop or reassign handle getting tonne of following error:
'system error. code: 1400. invalid window handle'
is there way manipulate process forces new handle assigned?
i solved doing following:
my main form created unseen 'helper' form never displayed, have visual components - throwing handle error when trying redraw these visual components, replaced relevant components objects instead (note did not write code originally).
there no way avoid re-creating window handles. instead, override window's createwnd
, destroywnd
methods you're notified when window re-created.
also, avoid keeping persistent references handles of windows might destroyed. instead, read handle
property each time need it. won't have watch notifications.
beware of reading handle
different thread, though, since may cause window become associated wrong thread. wrap code needs interact vcl window method call via synchronize
or queue
.
Comments
Post a Comment