I guess fChwnd is panel1.handle if this works
And if there's a need to call the second part of code at all then I guess panel handle changes while docking/dragging?