All right.
I found some interesting information in the MSDN, but I still don't
know how to get the handle to a scroll bar.
I am using GetScrollInfo() to get information on the scroll bar in a
window. It works only with SB_CTL with notepad.exe and the Microsoft
Word Viewer(returns 1). SB_VERT returns 0(i am just interested in the
vertical scroll bar so far).
<code>
Public Function Scroll() As Boolean
Dim retValue As Boolean
Dim si As SCROLLINFO
Dim lRet As Integer
si = New SCROLLINFO
With si
.cbSize = Len(si)
.fMask = ScrollInfoMask.SIF_ALL
End With
lRet = GetScrollInfo(New
IntPtr(_current_file.pInfo.dwThreadId), ScrollBarDirection.SB_CTL, si)
If 0 = lRet Then
lRet =
System.Runtime.InteropServices.Marshal.GetLastWin32Error()
MsgBox("Last Win32-Errorcode: " & lRet.ToString)
End If
Return retValue
End Function
</code>
"_current_file" is a simple object which stores a file path and the
process information about the application which opened it with
CreateProcess:
<code>
Public Structure PROCESS_INFORMATION
Public hProcess As IntPtr
Public hThread As IntPtr
Public dwProcessId As Integer
Public dwThreadId As Integer
End Structure
</code>
Is there a way to get to the scroll bar control of the process or
window?
Regards,
Thomas
Thomas Wieczorek <wieczo.yo@googlemail.com> schrieb im Beitrag
<cee96e82-58ae-4eab-8f02-ffb53f6ee2bb@l32g2000hse.googlegroups.com>...
> <code>
> ...
[quoted text clipped - 3 lines]
> Is there a way to get to the scroll bar control of the process or
> window?
You are using VB.NET, but this newsgroup is dealing with VB <= 6.0 which
has not much more in common with VB.NET but the name. So you should ask
your question in an appropriate newsgroup - look out for newsgroups with
"dotnet" in their names.
Just a hint:
There have to be four types of scroll bars taken into account:
Type 1: Scroll bar control
This is a 'real' window of the standard window class "SCROLLBAR". Scroll
bar messages and functions of the Windows API for scroll bar controls are
supported.
Type 2: Standard scroll bar
This isn't a window but part of the non-client area of a window with the
window style WS_HSCROLL and/or WS_VSCROLL. Scroll bar messages and
functions of the Windows API for standard scroll bars are supported, if the
window procedure of the window with the standard scroll bar(s) doesn't
prevent support.
Type 3: Custom scroll bar controls
This is a 'real' window either based on the standard window class
"SCROLLBAR" or another registered window class (which may have been
registered for use by any application or by its 'owner' application only).
Support of Windows API scroll bar messages and functions for scroll bar
controls depends on the implementation of the window class - they may be
supported or not. Usually the documentation of the custom control informs
you about this.
Type 4: Application specific scroll bar implementation.
This is a scroll bar completely handled and drawn by the application,
usually without a window of its own. Support of Windows API scroll bar
messages and functions depends on the application - but is very unlikely.
For type 1 search for a child window of the main window which is of the
window class "SCROLLBAR". Then use the retrieved window handle, if any,
with Windows API scroll bar messages and functions.
For type 2 send/call Windows API scroll bar messages and functions with the
window handle of the window in question which has the WS_HSCROLL/WS_VSCROLL
window style.
For type 3 you have to know the window class name of the custom scroll bar
control. Then find the window and call GetScrollInfo() with the retrieved
window handle. If this failes, the control doesn't support the Windows API
scroll bar functions for scroll bar controls. Then send the found window a
SBM_GETSCROLLINFO message. If this failes, the control doesn't support
Windows API scroll bar messages for scroll bar controls either. If neither
functions nor messages are supported, the only other possible ways are a)
using an API for this provided by the control, if any, or b) synthesizing
mouse events (see SendInput()).
The same is valid for type 4 except that you have to use the handle of the
window with the application specific scroll bar implementation.

Signature
----------------------------------------------------------------------
THORSTEN ALBERS Universität Freiburg
albers@
uni-freiburg.de
----------------------------------------------------------------------