You use the EnumChildWindows function and test the window class like this:
function EnumChildProc(AHandle: hWnd; AnObject: TObject): BOOL; stdcall;
var
tmpS : string;
theClassName : string;
begin
Result := True;
SetLength(theClassName, 256);
GetClassName(AHandle, PChar(theClassName), 255);
tmpS := UpperCase(StrPas(PChar(the
if Pos('SCROLLBAR', tmpS) > 0 then
begin
// ScrollbarHandle is a global variable of type THandle;
ScrollbarHandle := AHandle;
end;
end;
procedure FindScrollBarHandle(AHandl
begin
EnumChildWindows(AHandle, @EnumChildProc, longInt(0));
end;
Main Topics
Browse All Topics





by: Freddy1990Posted on 2009-08-01 at 04:22:18ID: 24994871
I'm not sure you can really... I've tried to find a way, but I haven't come up with anything so far, however, you can influence a control's scrollbar even if you don't have the handle, Microsoft has a pretty decent API for controlling scrollbars.
en-us/libr ary/ bb7875 81%28VS.85 %29.aspx en-us/libr ary/ bb7875 35%28VS.85 %29.aspx
en-us/libr ary/ bb7875 83%28VS.85 %29.aspx en-us/libr ary/ bb7875 85%28VS.85 %29.aspx en-us/libr ary/ bb7875 87%28VS.85 %29.aspx
en-us/libr ary/ bb7875 95%28VS.85 %29.aspx en-us/libr ary/ bb7875 97%28VS.85 %29.aspx en-us/libr ary/ bb7875 97%28VS.85 %29.aspx
en-us/libr ary/ bb7875 91%28VS.85 %29.aspx
The GetScrollBarInfo api will get you information about a scrollbar, you can just pass it the handle of the window control that holds the scrollbar: http://msdn.microsoft.com/
It returns this struct: http://msdn.microsoft.com/
Tehre's also the GetScrollInfo, GetScrollPos and GetScrollRange function and Set functions for those 3 as well:
GetScrollInfo: http://msdn.microsoft.com/
GetScrollPos: http://msdn.microsoft.com/
GetScrollRange: http://msdn.microsoft.com/
SetScrollInfo: http://msdn.microsoft.com/
SetScrollPos: http://msdn.microsoft.com/
SetScrollRange: http://msdn.microsoft.com/
And the ScrollWindow api should allow you to just scroll: http://msdn.microsoft.com/
Those apis should allow you to do about anything with a window control's scrollbar without actually knowing the handle...