Click here to Skip to main content
15,881,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Does anyone know how to get and set the scroll position of a running Word file from a C++ application? For example I am running Word using a Shellexecute call in my program but I want to restore the last known scroll position in the file.
Posted

You could try sending the SBM_SETSCROLLINFO[^] message directly to the scroll bar control in Word. The vertical scrollbar should have the caption "Vertical". You can use FindWindowEx[^] to find the vertical scrollbar if you have the parent handle. I believe you can call SBM_GETPOS [^] to get the current position of the scroll bar.
 
Share this answer
 
v4
To answer your second question:

For example, using the parent handle (parent_hwndN) for the Word application, you can try this:


vscr_hwnd= FindWindowEx( 
parent_hwndN,
NULL,
"NUIScrollbar",
"Vertical",
);
 
Share this answer
 
Thanks for your response. I do have the parent handle but I am having trouble w/FindWindowEx. Is this the proper form to get the vertical scrollbar?

vscr_hwnd=::FindWindowEx(
parent_hwndN,
NULL,
"Vertical",
NULL
);
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900