Dennis9
asked on
ScrollBar....
Hi experts.
I would like som code that could scroll in aonther program, by just having the main windows handle.
So i want a procedure like:
Procedure ScroolUp(handle:thandle);
...
Procedure ScroolDown(handle:thandle) ;
Hope you understand what i mean.
ps. i dont want an easy solution where the mouse gets moved or something like that...
I would like som code that could scroll in aonther program, by just having the main windows handle.
So i want a procedure like:
Procedure ScroolUp(handle:thandle);
...
Procedure ScroolDown(handle:thandle)
Hope you understand what i mean.
ps. i dont want an easy solution where the mouse gets moved or something like that...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Seems ScrollBy is not what you need. Sorry, I did not notice it in a hurry. Because it is working only with an Object, not with a Handle.
Anyhow, you can probably write Form1.ScrolBy(50,50); it scrolls the contents of a windowed control, look at the VCL Help: procedure ScrollBy(DeltaX, DeltaY: Integer);
Maybe its source will help you somehow:
procedure TWinControl.ScrollBy(Delta X, DeltaY: Integer);
var
IsVisible: Boolean;
I: Integer;
Control: TControl;
begin
IsVisible := (FHandle <> 0) and IsWindowVisible(FHandle);
if IsVisible then ScrollWindow(FHandle, DeltaX, DeltaY, nil, nil);
for I := 0 to ControlCount - 1 do
begin
Control := Controls[I];
if not (Control is TWinControl) or (TWinControl(Control).FHan dle = 0) then
begin
Inc(Control.FLeft, DeltaX);
Inc(Control.FTop, DeltaY);
end else
if not IsVisible then
with TWinControl(Control) do
SetWindowPos(FHandle, 0, FLeft + DeltaX, FTop + DeltaY,
FWidth, FHeight, SWP_NOZORDER + SWP_NOACTIVATE);
end;
Realign;
end;
Anyhow, you can probably write Form1.ScrolBy(50,50); it scrolls the contents of a windowed control, look at the VCL Help: procedure ScrollBy(DeltaX, DeltaY: Integer);
Maybe its source will help you somehow:
procedure TWinControl.ScrollBy(Delta
var
IsVisible: Boolean;
I: Integer;
Control: TControl;
begin
IsVisible := (FHandle <> 0) and IsWindowVisible(FHandle);
if IsVisible then ScrollWindow(FHandle, DeltaX, DeltaY, nil, nil);
for I := 0 to ControlCount - 1 do
begin
Control := Controls[I];
if not (Control is TWinControl) or (TWinControl(Control).FHan
begin
Inc(Control.FLeft, DeltaX);
Inc(Control.FTop, DeltaY);
end else
if not IsVisible then
with TWinControl(Control) do
SetWindowPos(FHandle, 0, FLeft + DeltaX, FTop + DeltaY,
FWidth, FHeight, SWP_NOZORDER + SWP_NOACTIVATE);
end;
Realign;
end;
ASKER
Ok it seems like it all went a bit dead here.
It dont seems like it can be done the smart way then.
So what if i want to use the not cool version like:
pt:tpoint;
begin
getcursorpos(pt);
//Get the posistion of the scrollbar and click with mouse
setcursorpos(pt);
end;
any ideas?
It dont seems like it can be done the smart way then.
So what if i want to use the not cool version like:
pt:tpoint;
begin
getcursorpos(pt);
//Get the posistion of the scrollbar and click with mouse
setcursorpos(pt);
end;
any ideas?
ASKER
what about sending the message that the mousewheel use?
Dennis9:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
ASKER
Anybody have and idea on how this could be done?
The most comon way i know is getting cordinates to scroll arrow, then simulate mouse clicks. Maybe thats the only way?
The most comon way i know is getting cordinates to scroll arrow, then simulate mouse clicks. Maybe thats the only way?
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:
the answers contains useful information, it would be mistake to delete,
but the original question is not solved
to split points between DaFox and LukA_YJK
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Some days and here is the Christmas Time. I wish good luck and good health for you all and for your loved ones
kacor
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area for this question:
the answers contains useful information, it would be mistake to delete,
but the original question is not solved
to split points between DaFox and LukA_YJK
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Some days and here is the Christmas Time. I wish good luck and good health for you all and for your loved ones
kacor
EE Cleanup Volunteer
ASKER
DaFox -> yeah it works in notepad, but why not other places?