Home All Groups Group Topic Archive Search About

Mouse/Screen Image Status

Author
20 Jun 2006 1:00 AM
Daniel N
Is it possible to determine if the image under a mouse changes in VB.net
code? For example if I position the mouse using the command;
Windows.Forms.Cursor.Position = New System.Drawing.Point(680, 595)

Is there code that would help me determine if the image under it has
changed?

Author
20 Jun 2006 12:05 AM
gene kelley
On Mon, 19 Jun 2006 18:00:11 -0700, "Daniel N"
<saintdark_***@yahoo.com> wrote:

>Is it possible to determine if the image under a mouse changes in VB.net
>code? For example if I position the mouse using the command;
>Windows.Forms.Cursor.Position = New System.Drawing.Point(680, 595)
>
>Is there code that would help me determine if the image under it has
>changed?
>
>
>
Changed how?
A new image has replaced a previous image?
It's the same image, but has been modified?

Gene
Author
20 Jun 2006 4:38 AM
Daniel N
Well, when I position the mouse in a certian area, eventually a new image
will replace what was there. I wanted to tell my program exactly when that
happened.

Show quoteHide quote
"gene kelley" <o***@by.me> wrote in message
news:aqee92t6obtbnmgeb68j7k0bdj72lv7rfv@4ax.com...
> On Mon, 19 Jun 2006 18:00:11 -0700, "Daniel N"
> <saintdark_***@yahoo.com> wrote:
>
>>Is it possible to determine if the image under a mouse changes in VB.net
>>code? For example if I position the mouse using the command;
>>Windows.Forms.Cursor.Position = New System.Drawing.Point(680, 595)
>>
>>Is there code that would help me determine if the image under it has
>>changed?
>>
>>
>>
> Changed how?
> A new image has replaced a previous image?
> It's the same image, but has been modified?
>
> Gene
Author
20 Jun 2006 5:57 AM
gene kelley
On Mon, 19 Jun 2006 21:38:47 -0700, "Daniel N"
<saintdark_***@yahoo.com> wrote:

>Well, when I position the mouse in a certian area, eventually a new image
>will replace what was there. I wanted to tell my program exactly when that
>happened.
>

There's not enough app description given to provide a definitive
answer. 

You might take a look at the PictureBox Invalidated event which fires
whenever an image is loaded.  You might be able to adapt something
like this:


Private CursorInBox as Boolean


    Private Sub PictureBox1_MouseEnter(ByVal sender As Object, _
        ByVal e As System.EventArgs) Handles PictureBox1.MouseEnter
        CursorInBox = True
    End Sub

    Private Sub PictureBox1_MouseLeave(ByVal sender As Object, _
        ByVal e As System.EventArgs) Handles PictureBox1.MouseEnter
        CursorInBox = False
    End Sub

    Private Sub PictureBox1_Invalidated(ByVal sender As Object, _
        ByVal e As System.Windows.Forms.InvalidateEventArgs) Handles _
PictureBox1.Invalidated
        If CursorInBox Then
            MsgBox("Picture changed")
        End If

End Sub

Gene


Show quoteHide quote
>"gene kelley" <o***@by.me> wrote in message
>news:aqee92t6obtbnmgeb68j7k0bdj72lv7rfv@4ax.com...
>> On Mon, 19 Jun 2006 18:00:11 -0700, "Daniel N"
>> <saintdark_***@yahoo.com> wrote:
>>
>>>Is it possible to determine if the image under a mouse changes in VB.net
>>>code? For example if I position the mouse using the command;
>>>Windows.Forms.Cursor.Position = New System.Drawing.Point(680, 595)
>>>
>>>Is there code that would help me determine if the image under it has
>>>changed?
>>>
>>>
>>>
>> Changed how?
>> A new image has replaced a previous image?
>> It's the same image, but has been modified?
>>
>> Gene
>
Author
20 Jun 2006 4:37 PM
Daniel N
The image is outside my form, so I am unsure what to do next. Thank you for
the help.

Show quoteHide quote
"gene kelley" <o***@by.me> wrote in message
news:eo1f92do58ai05bnj54agh44r1rqkche2r@4ax.com...
> On Mon, 19 Jun 2006 21:38:47 -0700, "Daniel N"
> <saintdark_***@yahoo.com> wrote:
>
>>Well, when I position the mouse in a certian area, eventually a new image
>>will replace what was there. I wanted to tell my program exactly when that
>>happened.
>>
>
> There's not enough app description given to provide a definitive
> answer.
>
> You might take a look at the PictureBox Invalidated event which fires
> whenever an image is loaded.  You might be able to adapt something
> like this:
>
>
> Private CursorInBox as Boolean
>
>
>    Private Sub PictureBox1_MouseEnter(ByVal sender As Object, _
>        ByVal e As System.EventArgs) Handles PictureBox1.MouseEnter
>        CursorInBox = True
>    End Sub
>
>    Private Sub PictureBox1_MouseLeave(ByVal sender As Object, _
>        ByVal e As System.EventArgs) Handles PictureBox1.MouseEnter
>        CursorInBox = False
>    End Sub
>
>    Private Sub PictureBox1_Invalidated(ByVal sender As Object, _
>        ByVal e As System.Windows.Forms.InvalidateEventArgs) Handles _
> PictureBox1.Invalidated
>        If CursorInBox Then
>            MsgBox("Picture changed")
>        End If
>
> End Sub
>
> Gene
>
>
>>"gene kelley" <o***@by.me> wrote in message
>>news:aqee92t6obtbnmgeb68j7k0bdj72lv7rfv@4ax.com...
>>> On Mon, 19 Jun 2006 18:00:11 -0700, "Daniel N"
>>> <saintdark_***@yahoo.com> wrote:
>>>
>>>>Is it possible to determine if the image under a mouse changes in VB.net
>>>>code? For example if I position the mouse using the command;
>>>>Windows.Forms.Cursor.Position = New System.Drawing.Point(680, 595)
>>>>
>>>>Is there code that would help me determine if the image under it has
>>>>changed?
>>>>
>>>>
>>>>
>>> Changed how?
>>> A new image has replaced a previous image?
>>> It's the same image, but has been modified?
>>>
>>> Gene
>>
>
>
>
Author
20 Jun 2006 2:55 PM
Larry Lard
Daniel N wrote:
> The image is outside my form, so I am unsure what to do next. Thank you for
> the help.

Aha, so you are watching another application's window? This most likely
takes you out of the realm of what will be 'straightforward' to do in
VB.NET (or in .NET period) - it will involve API calls, I'm fairly
sure. You might try asking in general terms how to do this in one of
the win32 groups, although their answers will probably be in C++, so be
prepared for that...


Unless of course someone is about to dazzle us with a clean managed
solution?

--
Larry Lard
Replies to group please
Author
20 Jun 2006 7:55 PM
gene kelley
Show quote Hide quote
On 20 Jun 2006 07:55:27 -0700, "Larry Lard" <larryl***@hotmail.com>
wrote:

>
>Daniel N wrote:
>> The image is outside my form, so I am unsure what to do next. Thank you for
>> the help.
>
>Aha, so you are watching another application's window? This most likely
>takes you out of the realm of what will be 'straightforward' to do in
>VB.NET (or in .NET period) - it will involve API calls, I'm fairly
>sure. You might try asking in general terms how to do this in one of
>the win32 groups, although their answers will probably be in C++, so be
>prepared for that...
>
>
>Unless of course someone is about to dazzle us with a clean managed
>solution?


Interesting how these added "by-the-way" statements can change
everything. 

Gene
Author
20 Jun 2006 7:55 PM
gene kelley
On Tue, 20 Jun 2006 09:37:28 -0700, "Daniel N"
<saintdark_***@yahoo.com> wrote:

>The image is outside my form, so I am unsure what to do next. Thank you for
>the help.
>

That statement creates a  whole new ballgame.  If you want to possibly
get some help, you need to describe in detail what the app is all
about.  What is the source of the image you are monitoring? (A web
page or webcam app perhaps?).  What is supoosed to happen when the
image does change?

Gene
Author
21 Jun 2006 2:16 AM
Daniel N
Essentially, I am playing a game using in an application. I am trying to
make a program that would automate me playing. When a clock appears in a
certain portion of the App, it is my turn to make a decision. That clock
appearing is the only way to tell my program when to automate a decision. My
plan was to move the cursor above where the clock appears, then where it
does, have my program automate the decision.
Author
21 Jun 2006 3:49 AM
gene kelley
On Tue, 20 Jun 2006 19:16:04 -0700, "Daniel N"
<saintdark_***@yahoo.com> wrote:

>Essentially, I am playing a game using in an application. I am trying to
>make a program that would automate me playing. When a clock appears in a
>certain portion of the App, it is my turn to make a decision. That clock
>appearing is the only way to tell my program when to automate a decision. My
>plan was to move the cursor above where the clock appears, then where it
>does, have my program automate the decision.
>

There is really no reliable way to do what you want to do.  Outside of
your application, the cursor is a screen cursor or the cursor of
another application.

Good Luck,

Gene