| View previous topic :: View next topic |
| Author |
Message |
suxi Newbie
Joined: 16 Jan 2005 Posts: 23
|
Posted: Fri Dec 02, 2005 9:58 am Post subject: hold mouse button and drag |
|
|
Hello and have a great day everyone
Is it possible to generate a mouse down or drag mouse event in VDS?
I need to move a slider control of a different application and wonder how this can be achieved in VDS.
Thanks a lot for your help
Best wishes
suxi |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Fri Dec 02, 2005 3:12 pm Post subject: |
|
|
| Code: |
%Z = @sendmsg(%%Window,WM_LBUTTONDOWN,0,0)
|
You will need to find the message id that represents WM_LBUTTONDOWN.
You can also use the WM_LBUTTONUP message id too. I'm not sure of
these values off the top of my head. Hopefully this will point you in the
right direction. Please read the API documentation for complete details
about these two messages. _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
suxi Newbie
Joined: 16 Jan 2005 Posts: 23
|
Posted: Fri Dec 02, 2005 4:55 pm Post subject: |
|
|
Hi Bill
Thanks a lot for helping out. Unfortunately I am using VDS because it is so simple. I tried to find some information on ms sites, but wow, that stuff is miles to complicate for me.
All the @sndmsg command is supposed to do is:
hold down the mouse with the left button at the current position, move the mouse 80 pixels to the right, let go of the button.
The right position I can easily address with the window click command, but the rest …
Again, thanks a lot for the help, have a nice weekend
Marc |
|
| Back to top |
|
 |
suxi Newbie
Joined: 16 Jan 2005 Posts: 23
|
Posted: Fri Dec 02, 2005 8:48 pm Post subject: |
|
|
I found some API Help in the file section. The following should for example generate a left double click on button2. But if you try it (I did on WinXP Pro), the Button2 flashes but doesn't seem to be bothered about beeing clicked.
Any ideas why these calls don't really work?
Thank you so much
title TEST
DIALOG CREATE,TEST,-1,0,213,84
DIALOG ADD,BUTTON,BUTTON1,10,10,,,,DEFAULT
DIALOG ADD,BUTTON,BUTTON2,10,100,,,,DEFAULT
DIALOG SHOW
:evloop
wait event
goto @event()
:BUTTON1BUTTON
%A = @sendmsg(@winexists(~BUTTON2),$0203,0,0)
rem Double clicks the button2 with left mouse button
goto evloop
:BUTTON2BUTTON
:CLOSE
exit
For my mouse drag I found the following but can't get any action out of it for probably the same reason as in the small example above. I must be missing something.
$0200 : wm_MouseMove
$0201 : wm_LButtonDown
$0202 : wm_LButtonUp
$0203 : wm_LButtonDblClk
$0204 : wm_RButtonDown
$0205 : wm_RButtonUp
$0206 : wm_RButtonDblClk
$0207 : wm_MButtonDown
$0208 : wm_MButtonUp
$0209 : wm_MButtonDblClk
WM_LBUTTONDOWN
WPARAM wParam
LPARAM lParam;
Parameters
wParam
Indicates whether various virtual keys are down. This parameter can be one or more of the following values.
MK_CONTROL
The CTRL key is down.
MK_LBUTTON
The left mouse button is down.
MK_MBUTTON
The middle mouse button is down.
MK_RBUTTON
The right mouse button is down.
MK_SHIFT
The SHIFT key is down.
MK_XBUTTON1
Windows 2000/XP: The first X button is down.
MK_XBUTTON2
Windows 2000/XP: The second X button is down.
lParam
The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.
The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.
WM_MOUSEMOVE
WPARAM wParam
LPARAM lParam;
Parameters
wParam
Indicates whether various virtual keys are down. This parameter can be one or more of the following values.
MK_CONTROL
The CTRL key is down.
MK_LBUTTON
The left mouse button is down.
MK_MBUTTON
The middle mouse button is down.
MK_RBUTTON
The right mouse button is down.
MK_SHIFT
The SHIFT key is down.
MK_XBUTTON1
Windows 2000/XP: The first X button is down.
MK_XBUTTON2
Windows 2000/XP: The second X button is down.
lParam
The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.
The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.
mk_LButton = $0001;
mk_RButton = $0002;
mk_Shift = $0004;
mk_Control = $0008;
mk_MButton = $0010; |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Sat Dec 03, 2005 2:47 pm Post subject: |
|
|
Hi Marc,
Don't know why I didn't think of this yesterday, but why not look into the
APIs for the Trackbar? I believe you should be able to send the trackbar
one message to accomplish the desired results. _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it."
Last edited by ShinobiSoft on Sat Dec 03, 2005 8:39 pm; edited 1 time in total |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Sat Dec 03, 2005 8:37 pm Post subject: |
|
|
Try TBM_SETPOS, the 2 params are:
| Quote: |
fPosition
Redraw flag. If this parameter is TRUE, the message redraws the control with the slider at the position given by lPosition. If this parameter is FALSE, the message does not redraw the slider at the new position. Note that the message sets the value of the slider position (as returned by the TBM_GETPOS message) regardless of the fPosition parameter.
lPosition
New logical position of the slider. Valid logical positions are the integer values in the trackbar's range of minimum to maximum slider positions. If this value is outside the control's maximum and minimum range, the position is set to the maximum or minimum value.
|
| Code: |
%P = @sendmsg(<trackbar window id>,$0405,1,100)
|
_________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
suxi Newbie
Joined: 16 Jan 2005 Posts: 23
|
Posted: Sun Dec 04, 2005 7:47 pm Post subject: |
|
|
Thank you for all the tipps.
I can clearly identify the track bar with @winatpoint and @winclass as msctls_trackbar32, but the above sendmsg command doesn't do a think to the trackbar.
Any ideas? Do I need to maybe load some extensions in order to enable the VDS use of Windows APIs?
Have a nice week
suxi |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Sun Dec 04, 2005 8:21 pm Post subject: |
|
|
Hi Marc,
I've noticed that with the @sendmsg() function the window handle must be
preceeded by the "%". Check your window handle to be sure that it is
returned preceeded by a "%".
You will prolly need to experiment with this. As FF mentioned in his post,
you should call the @sendmsg() function with the message identifier for
the TBM_GETPOS message to obtain the the current position of the slider
within the track bar. I'm guessing that the numeric identifier for
TBM_GETPOS is $0404, however this is only an educated guess. From
here you will need to experiment with the desired new position for the
track bar. The only thing that you will need to change in FF's sample is the
lParam number. This is the number that specifies where to set the track
bars slider to. _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Mon Dec 05, 2005 4:06 am Post subject: |
|
|
TBM_GETPOS = $0400 _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
suxi Newbie
Joined: 16 Jan 2005 Posts: 23
|
Posted: Tue Dec 06, 2005 10:13 am Post subject: |
|
|
Wonderful and don't ask me why I couldn't make the slider move before, suddenly it does. Finding the min and max values works, too.
Unfortunately there is one major problem left to solve: How does the application learn, that the slider value has changed? Although the slider has visually moved on screen and the get_pos command correctly returns the new slider value, the application doesn't know that it has changed. Even simulating a left mouseclick on the max slider position doesn't change this.
Moving the slider with the mouse by hand immediately works
Any more ideas?
Thanks a lot and have a nice day!
Marc
%%trackbar_ID = @winatpoint(380,440)
#min/max range
%%min = @sendmsg(%%trackbar_ID,$0401,0,0)
%%max = @sendmsg(%%trackbar_ID,$0402,0,0)
#set trackbar
%x = @sendmsg(%%trackbar_id,$0405,1,%%max)
#position
%%position = @sendmsg(%%trackbar_id,$0400,0,0)
info %%position %%max |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Tue Dec 06, 2005 2:58 pm Post subject: |
|
|
For an application written in lets say C, all I would need to do would be to
set a message hook and watch the messages sent to the message hook
for the appropriate notification message. Since VDS isn't capable of
specifying a window procedure or the like, I don't think that this is possible.
However, we have some very ingenious people here and someone may
have already found a way that I don't know about. _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Tue Dec 06, 2005 5:26 pm Post subject: |
|
|
Are you activating the window of the program you are trying to control first?
It may be that the application checks to see if it has focus before processing the trackbar messages.
That's just a shot in the dark, but clicking and moving the trackbar should send the same message you are. _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
suxi Newbie
Joined: 16 Jan 2005 Posts: 23
|
Posted: Wed Dec 07, 2005 3:03 pm Post subject: |
|
|
Yes. First I activate the Window, then I click on the slider, then I send the message. The sliders moves, the new slider value changes to the slider max value, but the application doesn't take any notice.
Very frustrating.
Best wishes
suxi |
|
| Back to top |
|
 |
Hooligan VDS Developer


Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Wed Dec 07, 2005 10:07 pm Post subject: |
|
|
This may be a completely ignorant question, but do you (programmatically) unclick (release) the mouse button?
Hooligan _________________ Hooligan
Why be normal? |
|
| Back to top |
|
 |
Aslan Valued Contributor


Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Wed Dec 07, 2005 11:46 pm Post subject: |
|
|
| Quote: | | Yes. First I activate the Window, then I click on the slider, then I send the message. The sliders moves, the new slider value changes to the slider max value, but the application doesn't take any notice. |
Just a guess but, maybe change the order:
1. Activate the Window
2.set the slider position
3.Click on and release the slider.
- OR -
1. Activate the Window
2. send mousedown msg to the trackbar
3. set the slider position
4. send mouseup msg to the trackbar
This would simulate actively moving the trackbar normally.
It may be that the application doesn't get the slider value until it gets a mouse event from the trackbar.
Just a thought,
Aslan |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|