procedure TForm1.Button2Click(Sender: TObject);
const
LSB = WS_EX_LEFTSCROLLBAR;
var
ExStyle: LONG_PTR;
begin
ExStyle := GetWindowLongPtr(AVTV.Handle, GWL_EXSTYLE);
// Check if RTL alignment specified for you component
if AVTV.BiDiMode = bdRightToLeft then
begin
// If so, then exclude LSB-constant and allow Windows place
// scrollbar on the right side of window
if (ExStyle and LS:cool: = LSB then
SetWindowLongPtr(AVTV.Handle, GWL_EXSTYLE, ExStyle and not LS:cool:;
end
else
if AVTV.BiDiMode = bdLeftToRight then
begin
// The same as operation above but for LTR order
if (ExStyle and LS:cool: <> LSB then
SetWindowLongPtr(AVTV.Handle, GWL_EXSTYLE, ExStyle or LS:cool:;
end;
end;