Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Visual Basic Scripting: Mouse Move


Hi,
I was just wondering does anyone know if VB script has commands for moving the mouse cursor and causing mouse clicks?

Thanks.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Visual Basic Scripting
I have a simple question/request. How do you programatically do a "Right Click" on the desktop and select an item in the popup menu?
I can not use Visual Basic. It must be in vbscript (.vbs).

Thanks

Scripting Applets From Visual Basic
I need to script a java applet (object). I access to the applet width:

Dim AP As IHTMLObjectElement
Set AP = IE.Document.applets(0)

I can see the applets pane, the plugin, the plugin´s pane and the OLEEmbeddedFrame. (with AP.getParent())
I can modify all the elements in the Pane, Buttons, TextField, etc...

DL = AP.getComponents() / array with the pane components
Result = DL(0).setText("Test") / change the text in the TextField

My problem is that this applet have a lot of Frames and I could not retrieve this frames as object.
When I add an Ispection over the applet the frames never appear.
When I inspect the frames of the Explorer appear "Interface not compatible"
Could anybody help me to retrieve this frames as object?

Many tanks
José Miguel

Visual Basic And Scripting - Resolved
Hi all,

How do you call a VBScript from Visual Basic? I made a vbscript with three functions and I want to be able to use them from a standalone VB project.

Sanctos

Scripting Languages In Visual Basic
Has any one ever written there own scripting language in Visual basic, Well i mean if the final user can write a program in a text box and the program will execute the commands. Well if you have could you please post the function that parses the text box.

Thanks

Visual Basic Language And Scripting
Hi,

Sorry for this dumb question. Is there a difference between VB language
and VB scripting? I need to buy a beginners VB scripting book, I just
don't want to pickup the wrong one.

Thanks.

Grep In Visual Basic Scripting
Hi,
Can I use grep a statement from a file in visual basic?

example: grep "test here" file.txt

Thanks.

Visual Basic 6 Webbrowser Gives Page Scripting Error??
I have been using visual baisc 6 to make custom a webbrowser. I use it
to mainly save ebay auction webpages for future referance. Lately when
I access some webpages I get "An error has occured in the script page"
in my VB custom browser. It says Line 440, Char 11, Syntax error code 0
and gives the URL webpage. I get this error with just some webpages.
 I don't get this error using MS internet webbrowser. Can this problem be solved? I don't think the problem is in my coding. Any solutions to this??? Maybe I
need to update something?? Using window XP.
thank you,

Weird Request :: Visual Basic To C Converter [MODS Please Move To C Forum]
Are there any around?
I've written a Visual Basic program and wish to use it on a Linux machine and so, obviously, have to convert it to C or SHELL somehow...
Is there a way or do you know of any programs that will do this for me?

Regards,

Jord

Inteli Mouse In Visual Basic
Why doesn't my mouse scroll proberly with the wheel in the Visual Basic compiler. It works every where else.

I am using VB 6 with Windows 2000

Rob

Mouse Wheel Events Do Not Work In The Visual Basic 6.0 IDE
I thought this might be helpful...

Mouse wheel events do not work in the Visual Basic 6.0 IDE

Here is the fix...

Move A Control In Run Time With MOUSE MOVE
I build with the MOUSE MOVE event a posibility to move a control in RUN TIME
But the move is not so good
Someone have a idea about a improve way to do this task

Thanks

Written A Code To Move Mouse And Simulate Mouse Click, Its Not Working??
this code is to move mouse and simulate the mouse click.

My intension is to place the cursor in the middle of the screen initially and move.

the code contains approriate comments ,i think that helps to understand code (actually i've seen it in some other forum and made small changes).



when i run the code the cursor is not placed at the centre of the screen??

whats wrong with my code?? please somebody correct it??

here i'm giving my entire code.. (please have patience and go through)


Option Explicit

' ----------------------------------------------
' * MouseEvent Related Declares *
' ----------------------------------------------
Private Const MOUSEEVENTF_ABSOLUTE = &H8000
Private Const MOUSEEVENTF_LEFTDOWN = &H2
Private Const MOUSEEVENTF_LEFTUP = &H4
Private Const MOUSEEVENTF_MIDDLEDOWN = &H20
Private Const MOUSEEVENTF_MIDDLEUP = &H40
Private Const MOUSEEVENTF_MOVE = &H1
Private Const MOUSEEVENTF_RIGHTDOWN = &H8
Private Const MOUSEEVENTF_RIGHTUP = &H10

Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, _
ByVal dx As Long, ByVal dy As Long, ByVal cbuttons As Long, _
ByVal dwExtraInfo As Long)

' ----------------------------------------------
' * GetSystemMetrics Related Declares *
' ----------------------------------------------
Private Const SM_CXSCREEN = 0
Private Const SM_CYSCREEN = 1
Private Const TWIPS_PER_INCH = 1440
Private Const POINTS_PER_INCH = 72
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex _
As Long) As Long

' ----------------------------------------------
' * GetWindowRect Related Declares *
' ----------------------------------------------
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, _
lpRect As RECT) As Long


' ----------------------------------------------
' * Internal Constants and Types *
' ----------------------------------------------

Private Const MOUSE_MICKEYS = 65535

Public Enum enReportStyle
rsPixels
rsTwips
rsInches
rsPoints
End Enum

Public Enum enButtonToClick
btcLeft
btcRight
btcMiddle
End Enum


' Returns the screen size in pixels or, optionally,
' in others scalemode styles
Public Sub GetScreenRes(ByRef X As Long, ByRef Y As Long, Optional ByVal _
ReportStyle As enReportStyle)

X = GetSystemMetrics(SM_CXSCREEN)
Y = GetSystemMetrics(SM_CYSCREEN)
If Not IsMissing(ReportStyle) Then
If ReportStyle <> rsPixels Then
X = X * Screen.TwipsPerPixelX
Y = Y * Screen.TwipsPerPixelY
If ReportStyle = rsInches Or ReportStyle = rsPoints Then
X = X TWIPS_PER_INCH
Y = Y TWIPS_PER_INCH
If ReportStyle = rsPoints Then
X = X * POINTS_PER_INCH
Y = Y * POINTS_PER_INCH
End If
End If
End If
End If
End Sub


' Convert's the mouses coordinate system to
' a pixel position.
Public Function MickeyXToPixel(ByVal mouseX As Long) As Long
Dim X As Long
Dim Y As Long
Dim tX As Single
Dim tmouseX As Single
Dim tMickeys As Single

GetScreenRes X, Y
tX = X
tMickeys = MOUSE_MICKEYS
tmouseX = mouseX

MickeyXToPixel = CLng(tmouseX / (tMickeys / tX))

End Function


' Converts mouse Y coordinates to pixels
Public Function MickeyYToPixel(ByVal mouseY As Long) As Long
Dim X As Long
Dim Y As Long
Dim tY As Single
Dim tmouseY As Single
Dim tMickeys As Single

GetScreenRes X, Y
tY = Y
tMickeys = MOUSE_MICKEYS
tmouseY = mouseY

MickeyYToPixel = CLng(tmouseY / (tMickeys / tY))

End Function


' Converts pixel X coordinates to mickeys
Public Function PixelXToMickey(ByVal pixX As Long) As Long
Dim X As Long
Dim Y As Long
Dim tX As Single
Dim tpixX As Single
Dim tMickeys As Single

GetScreenRes X, Y
tMickeys = MOUSE_MICKEYS
tX = X
tpixX = pixX

PixelXToMickey = CLng((tMickeys / tX) * tpixX)

End Function


' Converts pixel Y coordinates to mickeys
Public Function PixelYToMickey(ByVal pixY As Long) As Long
Dim X As Long
Dim Y As Long
Dim tY As Single
Dim tpixY As Single
Dim tMickeys As Single

GetScreenRes X, Y
tMickeys = MOUSE_MICKEYS
tY = Y
tpixY = pixY

PixelYToMickey = CLng((tMickeys / tY) * tpixY)

End Function


' The function will center the mouse on a window
' or control with an hWnd property. No checking
' is done to ensure that the window is not obscured
' or not minimized, however it does make sure that
' the target is within the boundaries of the
' screen.
Public Function CenterMouseOn(ByVal hwnd As Long) As Boolean
Dim X As Long
Dim Y As Long
Dim maxX As Long
Dim maxY As Long
Dim crect As RECT
Dim rc As Long

GetScreenRes maxX, maxY
rc = GetWindowRect(hwnd, crect)

If rc Then
X = crect.Left + ((crect.Right - crect.Left) / 2)
Y = crect.Top + ((crect.Bottom - crect.Top) / 2)
If (X >= 0 And X <= maxX) And (Y >= 0 And Y <= maxY) Then
MouseMove X, Y
CenterMouseOn = True
Else
CenterMouseOn = False
End If
Else
CenterMouseOn = False
End If
End Function


' Simulates a mouse click
Public Function MouseFullClick(ByVal MBClick As enButtonToClick) As Boolean
Dim cbuttons As Long
Dim dwExtraInfo As Long
Dim mevent As Long

Select Case MBClick
Case btcLeft
mevent = MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP
Case btcRight
mevent = MOUSEEVENTF_RIGHTDOWN Or MOUSEEVENTF_RIGHTUP
Case btcMiddle
mevent = MOUSEEVENTF_MIDDLEDOWN Or MOUSEEVENTF_MIDDLEUP
Case Else
MouseFullClick = False
Exit Function
End Select
mouse_event mevent, 0&, 0&, cbuttons, dwExtraInfo
MouseFullClick = True

End Function


Public Sub MouseMove(ByRef xPixel As Long, ByRef yPixel As Long)
Dim cbuttons As Long
Dim dwExtraInfo As Long

mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_MOVE, _
PixelXToMickey(xPixel), PixelYToMickey(yPixel), cbuttons, dwExtraInfo

End Sub

Simulate Mouse Move And Mouse Click With Directinput
I've been trying to figure this one out for a while. I can already do it with mouse_event calls but would like to get it working with direct input. I've found lots of tutorials on how to HANDLE mouse input with directinput, but not one tutorial on how to simulate mouse events with directinput. (without using mouse_event at all). I'm getting stumped here, and Im pretty new to the directx sdk, so please use kid gloves

- How To Draw Image On Mouse Down / Mouse Move
hi friends,
i hv two picture boxes. pic1 contains a image (16 * 16 pixel). on mouse down of pic2 i need to draw the pic1 image on pic2, a perfect square
how do i do that
plz help.

thanx in advance
harry

regards

harry

Mouse Move + Repete While Mouse Is Held..
I have a small grid of picture boxs i'm using for some drawing program. What i'm hoping todo is, as the mouse is moved over the pictures and the left mouse button is held change the picture the mouse is over.

Works fine using MouseMove, only problem i'm having is getting it to read when the left button being helt down. If Button = 1 Then.. only triggers once, when the buttons first pressed.

Any help would be great, cheers

How To Show A Toolbar On The Flash Move In IE When Mouse Move To It Like Flash Catcher?
How to show a toolbar on the flash move in IE when mouse move to it like Flash Catcher ?

VB Scripting Basic Question
I have a picture called red_button.bmp and a picture called blue_button.bmp.

I would like the exact code in VBScript to have it so when you mouse over the red_button.bmp picture that the pic turns to the blue_button.bmp and when the mouse is moved off again the button turns back to red_button.bmp

Mouse Move, Mouse Click
I know you can make the mouse move to a certain spot on the screen, but can you make it 'click'??? If you cant to that can you make it press a key(, Enter, Letters, Keys, Ect...)?

How To Move A Record From One Database Table To Another Database Table In Visual Basic Us
Hi
 
   plz help me

  How to move a record from one database table to another database table in visual basic using MSAccess Database
  using ADODB Record set.


  Datbase A from table a
           to
  Database B to table b.

   

Thanks


Yours

mk_mur

Word And Visual Basic [ How Can I Get The Save As Window Through Visual Basic? ]
Hi, I made a small program in visual basic that with the use of

Dim oWord as new word.application
Dim oDoc as new word.document

fills a document with some data from the visual basic.
I want when those data are loaded in word the save or save as window to appear.
The command oDoc.saveAs saves the document without even asking for a filename.

What Can I do?

How Do I Run A Program I Made In Visual Basic On A Computer Without Visual Basic?
I created a program in Visual Basic and I was curious at what I needed to do to be able to install or use this program on a computer without Visual Basic. Any help would be great! Thanks in advance.

Extracting Visual Basic Source Code From Visual Basic EXE
hi everyone,

Well actually the problem in my case is that i had mad an EXE in VB6 around a week ago and had stored the EXE and th source code in two diferent folders. By mistake somebody ha deleted the source code folder. I wanted to make some changes i the EXE code and Now i have only the EXE folder to deal with.

Is there any method by which i can extract the Visual Basic cod from the VB EXE. Is there any application or software which ca help me in this? Do give me the hyperlink for downloading th EXE for the extraction if possible.

Please let me know at the earliest.

Thanks in advance.

Ankit

Is Visual Basic Script As Ubset Of Visual Basic
Hello

Is visual basic script a subset of Visual Basic code?

Visual Basic Items Removed From Visual Basic.NET
A while ago (maybe up to a year) I had found a web page (probably a Microsoft MVP's home age) that had a list of about 100 things that were removed from Visual Basic in the transition to Visual Basic.NET. As it is, I would like to look at that again, but I can't seem to find it on my computer. Does anyone remember this page and/or have a copy of the link or the file that was on it. It has particular things like Debug.Print is no longer valid and MsgBox function is not supported. I've look on Microsoft's website and found a great deal of information about implementation difference, but I can't seem to locate this particular piece. If anyone could help I would appreciate it very much.

Thanks in Advnance

Nick August

On Mouse Move
I am trying to figure it out what code do I use when I move my mouse out of the command button to load different picture into the command button

example:

1st I make a command button graphical then
I load a picture into the command button in design time, then
when I move mouse over different picture is loaded, and when I move my mouse out of the command button different picture has to be loaded, That where I am having trouble.

Some one please help.

Thanks

On Mouse Move.. How Do You?
I have a form that is full screen and in it is a webbrowser control also full size of form. what i want to do is when the mouse moves to hide the form and show another

Now the problem is the form doesn't detect the mouse movement through the web browser because it works fine with an empty form.

How do I detect mouse movement no matter what the mouse is on , even if it is not on the form if the form is not maximized?

Move A Mouse
I am making a help program and I was wondering how I could move a mouse to a certain location.

If a user clicks on help, and loads the demo. I want the mouse to be able to move to a certain spot and click on the drop down menu, and so on.


Thanks

he9ap00

Mouse Down, Up, Move
ok can i know the difference between the 3 of them...

I would say that Mouse Down is when you click on something and that your finger on the mouse is till holding it...
Finally Mouse up would be when you release the mouse button and Mouse Move would be like when you move the mouse over that object...
and another thing is the dragDrop and the dragOver. What does it do and what the difference with OLE action...

if you know a webpage that explain those option or in the tutorial here not sure i search but there was too many result dunno how to formulate that research...

Mouse Move
any one can help????
how to program to move the cursor in the website??? (act as a mouse)when i have already program to link to it already...
Thanks!!!!

Mouse Move
i have an app where there is a "answer" textbox on the form.
I also have created a form in the shape of a speach bubble and have written code that puts some help text into it.
But i'm having a problem displaying it, i want it to do as follows.
No matter where the form is physically on the screen or where at what point i hover over the text box i want the speach bubble form to popup to the top and right of where the mouse pointer is.
I have not really used the mouse move event before.

Help anyone ???

thanks.

Mouse Move
Hi,
I am trying to popup a form next to the mouse pointer when ever the mouse pointer is moved over a certain text box.
I have put this into my functions module.

Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

and have this code in the txtbox.mousemove()....

ShapedForm.Move POINTAPI * Screen.TwipsPerPixelX, POINTAPI * Screen.TwipsPerPixelY + ShapedForm.ScaleHeight

ShapedForm.Show vbModal

but this does not work, can anyone see a problem or im i missing somthing ???

Cheers.

Move Mouse
hi all ,

my problem is that i want to move my mouse on vb form after form load to the exact position ex.-i have cmd button on a form i want to show that pointer is going to cmd button .
pointer should go shlowly.it should be viewable.
giv me suitable answer .
thanks,
abhishek mishra

Move Mouse X And Y
Hey , how can i move the mouse x and y co ordinates via code?

i dont mean on the form. ill have the form in the background and i can press a button and the mouse moves to a set location.

something like screen.mouse.x = 500 screen.mouse.y = 200

but actual code instead

Mouse Move
I have a program where you move the mouse on the form to work it. I want to be able to detect when i'm not on the form such as the when the mouse is on the blue bar on the top or on the taskbar or around the window. How can i do this?

Move Mouse
how would you make the mouse move to a certain place into an active x control, then click, then type something?

Move The Mouse
How could using VB could I make it move my mouse say 30 degrees upwards?

Or how could I using VB have it press in pageup and the left arrow key for a certain ammout of time in miliseconds then rightclick?

Mouse Move
My form contains a label and a textbox

What i want is , when my mouse moves over the textbox ,

label should show a text message , and show blank when the mouse is no longer on the textbox.

i used the mousemove event of the textbox and form , but in case another textbox is placed close to this textbox , and if i immediately takes the mouse to this second textbox , label does not get blank .


Any solutions ?

Thanks.

Mouse Move
Hey. I want move the mous pointer via code (specifically to have it click a portion of the screen over and over again). How do I do this?

Move Mouse
i'm using this code for moving the mouse, but how do i make it move to yes or no in a message box?

Mouse Move
This text I cut from MSDN help
(Text in brackets is what I need). Thanks in advance

How MouseMove Works
How many times does the MouseMove event get called as the user moves the pointer across the screen? Or, to put it another way, when you move the pointer from the top of the screen to the bottom, how many locations are involved? (I need to be inlolved all locations)

Visual Basic doesn't necessarily generate a MouseMove event for every pixel the mouse moves over. (i need for every pixel)
The operating environment generates a limited number of mouse messages per second. (I need no limits).


Note that the faster the user moves the pointer, the fewer MouseMove events are recognized between any two points.

Your application can recognize many MouseMove events in quick succession. Therefore, a MouseMove event procedure shouldn't do anything that requires large amounts of computing time. (I don't care about computing time)

For More Information See "MouseMove Event" in the Language Reference.

Move Mouse
i WANT TO USE A TIMER TO MOVE THE MOUSE FROM TOP TO BOTTOM CAN ANY ONE TELL ME HOW TO DO THAT?
tHANKS FOR AMY HELP

Mouse Move
I have a code to move a picture when a mouse down event happens. It works fine but I need the image to stop moving when the mouse has move beyond the image. in the X direction. Is there a mouse over event ? I tried X1 position but still not working.



Code:


Option Explicit

Dim moveimage As Boolean
Dim y1 As Single
Dim x1 As Single
Dim MoveY As Single

Private Sub Form_Load()

    moveimage = False
    Image1.Top = 3000
    MoveY = Image1.Top
End Sub


Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
moveimage = True
End Sub

Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, x1 As Single, y1 As Single)

If moveimage = True Then 'And (x1 < 350) And (x1 > 750) Then
Image1.Top = y1 + MoveY
 MoveY = y1 + MoveY
End If

End Sub

Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
moveimage = False

End Sub

Mouse Move
Hello everybody .
I'm working on a screensaver project and i have a tiny problem.
My project is with 2 forms one as load form and the other as screensaver form .the problem is that when i make the second form visible(screensaver form) and i have the exit function in the mouse move sub the form appears instantly and then dissapear but when i put the exit function in image_dblclick it works fine.
Is that a bug and the second form thinks that the mouse is moving???

How To Move The Mouse ?
Hi,

Ok, i'm perhaps stupid, but, how can you move the mouse (and click) with visual basic (v4) ?

Is there any method or control ?

Pleas help !

Fred

Move Mouse
Is there anyway you can move the mouse to a certain position on your form?..I just need to now how to put the mouse in different positions on my form

Can Mouse Move Be Surpressed??
Currently I have a form with a control on it. I want to catch the mouse move event in the form everywhere but when the mouse moves over the control the mouse move event of the form no longer fires. Can I surpress the mouse move of the control so that the form mouse move fires??? Phew!

Cheers,

Col

Mouse Move/sensitivity
hi, im making a flyswatting game which uses tiles and the mouse. what i wanted was for the 'swatter' to move one tile after the mouse moved say 5 pixels. I was going to have it so it puts the sqatter in the tile the mouse is over but the tiles are too large for that and it makes the mouse swatter move slowly.
any ideas??
thanks

Mouse Move Method Help
I need some help. I am trying to compleat a project for school and I am stuck.
It should be really easy to do, but I just cant figuar it out.

When the mouse moves over a listbox I want a MsgBox to appear, but only once. I tried this:

Private Sub ListBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
Dim f As Integer
Dim ove As Integer
If f = 0 Then
ove = MsgBox("To learn more about the different options please select one", _
vbExclamation Or vbOKOnly, "Information")
f = f + 1
End If
End Sub

but it does not work! I was thinking about using a Boolean variable.
Please help,
Thanks

Copyright © 2005-08 www.BigResource.com, All rights reserved