Some of you may have seen my call for help with an OpenGL error. Well I tracked the bug down to a change in the SetWindowState procedure in vcl.forms. Nothing to do with OpenGL or threading.
Some of you may have seen my call for help with an OpenGL error. Well I tracked the bug down to a change in the SetWindowState procedure in vcl.forms. Nothing to do with OpenGL or threading.
Here's the bug:
The if Showing then ... end is new, specifically the RecreateWnd which is not in 10.1. I have wasted many days over this. Very poor. Is there any regression testing going on at EMBA?
if FWindowState <> Value then
begin
FWindowState := Value;
if not (csDesigning in ComponentState) then
begin
if Showing then
ShowWindow(Handle, ShowCommands[Value])
else if HandleAllocated and (FWindowState = wsMaximized) then
RecreateWnd; <<<< this is new and breaks my application
end;
end;
Here's the bug:
The if Showing then ... end is new, specifically the RecreateWnd which is not in 10.1. I have wasted many days over this. Very poor. Is there any regression testing going on at EMBA?
if FWindowState <> Value then
begin
FWindowState := Value;
if not (csDesigning in ComponentState) then
begin
if Showing then
ShowWindow(Handle, ShowCommands[Value])
else if HandleAllocated and (FWindowState = wsMaximized) then
RecreateWnd; <<<< this is new and breaks my application
end;
end;
Jeff Dyer Well the VCL wraps the windowing API, as such the Handle property reflects an implementation detail. Relying on such implementation details always carry risk in terms of code stability.
ReplyDeleteMost bare OpenGL I've seen has used the windowing API directly, in which case any window handle creation was quite explicit. They would of course not do any of the things which requires creating a new handle, so this issue wouldn't show there.
Jeff Dyer The part of the documentation you've quoted doesn't contradict the idea that the VCL can recreate a handle at will. In fact, this is implied - the underlying point being, it's the VCL that owns and maintains a control or form's handle, not the VCL application.
ReplyDeleteThe fact is that it unnecessary to recreate a window for the purpose of changing its state regardless of visibility.
ReplyDeleteAnother fact is that it is simply sloppy progamming on EMBT''s part and furthermore EMBT is quite likely making the justification do so based on other sloppy programming and unsound reasoning.