SendMessage(PageMemo.handle, WM_VSCROLL, MakeLong(SB_THUMBPOSITION, VrtBarPos));
The above function is what I have used for years.
It works for the RUN test by the compiler. It also
works if I put the compiled EXE into a new folder.
But once WINDOWS realizes that I have done this,
they block the SENDMESSAGE function; ie. it just
won't scroll anymore. This has developed recently,
and I think it is a security issue by WINDOWS.
So I am trying to implement the ScrollInfo method.
Below is the ScrollWindowEx function. It is supposed
to work, but I am misunderstanding its parameters.
I also can't find any Pascal explanations for it.
Lower is a SynEdit application from its unit. The
compiler does not like the coding. Thus I am trying
to translate it for the compiler environment.
Lower again is a C code example by Windows. Lazarus
doesn't like any of that!
Can anyone show me how I should actually load
ScrollWindowEx? Windows tells me that everything
but the HANDLE and SET_POSITIONS should be NULL.
Then you call UpdateWindow to make it happen.
I suspect that the @AreaRect entries are improper.
I also haven't found any information on the FLAGS.
// VARIABLES
// VrtBarPos:= SetScrollPos(PageMemo.handle, SB_VERT, VrtBarPos, TRUE); // integer
// var AreaRect: TRect;
// GetVrtOK: boolean;
// SetVrtPos: integer;
AreaRect:= rect(null,null,null,null);
SetVrtPos:= GetScrollPos(PageMemo.handle,SB_VERT); // integer
GetVrtOK:= ScrollWindowEx (PageMemo.handle, // RichMemo application
0, // horizontal element
(VrtBarPos - SetVrtPos), // old and new positions
@AreaRect,
@AreaRect,
0,
@AreaRect,
2); // boolean
GetVrtOK:= UpdateWindow(PageMemo.handle); // must execute
end else showmessage('VRT-SCROLLBAR FAILED 17');
SynEdit Unit
ScrollWindowEx (HWND=PageMemo.handle,
DX=0,
DY=(VrtBarPos - SetVrtPos),
PRCSCROLL=0x0,
PRCCLIP=0x0,
HRGNUPDATE=0,
PRCUPDATE=0x0,
FLAGS=2); // boolean
Windows Example
ScrollWindowEx(
hWnd: HWND;
dx: Integer;
dy: Integer;
prcScroll: PRect;
prcClip: PRect;
hrgnUpdate: HRGN;
prcUpdate: PRect;
flags: UINT
):Boolean;
Scroll the window. The system repaints most of the
client area when ScrollWindowEx is called; however, it is
necessary to call UpdateWindow in order to repaint the
rectangle of pixels that were invalidated.
C CODE EXAMPLE:
ScrollWindowEx(hwnd, -xDelta, -yDelta, (CONST RECT *) NULL,
(CONST RECT *) NULL, (HRGN) NULL, (PRECT) NULL,
SW_INVALIDATE);
UpdateWindow(hwnd);