cosminm
asked on
Checkbox status
I want to change checked/unchecked a checkbox with a mouse positioned above it. Could you help me with an example?
Oh cosminm,you are in here!
this is my answer:
var pt:tpoint;
begin
....
pt:=Form1.ClienttoScreen(p oint(Check Box1.Left, CheckBox1. Top));
SetCursorPos(pt.x+4,pt.y+4 );
....
end;
menxin
this is my answer:
var pt:tpoint;
begin
....
pt:=Form1.ClienttoScreen(p
SetCursorPos(pt.x+4,pt.y+4
....
end;
menxin
ASKER
The problem is that the checkbox is not in my program (is somewhere on the screen)... :(
I posted the q. here because I'm in a hurry and I offer points. :)
I posted the q. here because I'm in a hurry and I offer points. :)
Principally you should do something like...
- try to find the window handle of the check-box
(and that's the tough part of the job)
- send it a message
State:=SendMessage(HWnd, BM_GETCHECK, 0, 0)
SendMessage(HWnd, BM_SETCHECK, State, 0)
I have no idea how to get the handle (maybe WindowFromPoint helps)
So long, Roadrunner
- try to find the window handle of the check-box
(and that's the tough part of the job)
- send it a message
State:=SendMessage(HWnd, BM_GETCHECK, 0, 0)
SendMessage(HWnd, BM_SETCHECK, State, 0)
I have no idea how to get the handle (maybe WindowFromPoint helps)
So long, Roadrunner
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Cool, worked.
I have one more (not burning)...
What are the API for get a string from a button.caption and a edit.text?
In fact I want to made an automation with clicks of a program outside mine...
Is there a component for this propose?
It would be much helpful...
I have one more (not burning)...
What are the API for get a string from a button.caption and a edit.text?
In fact I want to made an automation with clicks of a program outside mine...
Is there a component for this propose?
It would be much helpful...
clickbutton?try this
SendMessage(WindowFromPoin t(Mouse.Cu rsorPos), wm_lbuttondown, 0, 0);
SendMessage(WindowFromPoin t(Mouse.Cu rsorPos), wm_lbuttonup, 0, 0);
and you can send a WM_GETTEXT message to a edit.
menxin
SendMessage(WindowFromPoin
SendMessage(WindowFromPoin
and you can send a WM_GETTEXT message to a edit.
menxin
var
CPos : TPoint;
begin
GetCursorPos(CPos);
if ControlAtPos(CPos) is TComboBox then
with (ControlAtPos(CPos) as TComboBox) do
Checked := Not Checked;
end;
Cheers,
Raymond.