Can you detect mose clicks by application/location?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Can you detect mose clicks by application/location?

  1. #1
    Kenneth Guest

    Can you detect mose clicks by application/location?


    Hi

    I want to be able to differentiate between mouse clicks occuring outside
    my VB form and those occuring inside it. I have tried including the following
    in a timer subroutine:

    If GetAsyncKeyState(vbLeftButton) Then
    MsgBox "Left button clicked" '--example code
    End If
    and this detects the left mouse button.

    The problem is that I also have a function:
    ListView1_ItemClick()
    which detects a click on a ListView box and Windows(NT) gives priority to
    GetAsyncKeyState() when the left mouse button is clicked and so clicking
    on the ListView box no longer invokes ListView1_ItemClick().

    Is there a function which I can include which Windows will call when the
    mouse clicks on a point outside my form (outside the control of my VB program)?
    In other words, is there something like a "GetSystemFocus" function?

    Kenneth

  2. #2
    Jonathan Wood Guest

    Re: Can you detect mose clicks by application/location?

    If I understand the problem, you could probably use WindowFromPoint to find
    out if the mouse is over your form. You'll need some sort of text for when
    the mouse is over child windows of your form.

    --
    Jonathan Wood
    SoftCircuits Programming
    http://www.softcircuits.com
    "Kenneth" <keneth.berry@barco.com> wrote in message
    news:3aefca24$1@news.devx.com...
    >
    > Hi
    >
    > I want to be able to differentiate between mouse clicks occuring outside
    > my VB form and those occuring inside it. I have tried including the

    following
    > in a timer subroutine:
    >
    > If GetAsyncKeyState(vbLeftButton) Then
    > MsgBox "Left button clicked" '--example code
    > End If
    > and this detects the left mouse button.
    >
    > The problem is that I also have a function:
    > ListView1_ItemClick()
    > which detects a click on a ListView box and Windows(NT) gives priority to
    > GetAsyncKeyState() when the left mouse button is clicked and so clicking
    > on the ListView box no longer invokes ListView1_ItemClick().
    >
    > Is there a function which I can include which Windows will call when the
    > mouse clicks on a point outside my form (outside the control of my VB

    program)?
    > In other words, is there something like a "GetSystemFocus" function?
    >
    > Kenneth




  3. #3
    Jonathan Wood Guest

    Re: Can you detect mose clicks by application/location?

    If I understand the problem, you could probably use WindowFromPoint to find
    out if the mouse is over your form. You'll need some sort of text for when
    the mouse is over child windows of your form.

    --
    Jonathan Wood
    SoftCircuits Programming
    http://www.softcircuits.com
    "Kenneth" <keneth.berry@barco.com> wrote in message
    news:3aefca24$1@news.devx.com...
    >
    > Hi
    >
    > I want to be able to differentiate between mouse clicks occuring outside
    > my VB form and those occuring inside it. I have tried including the

    following
    > in a timer subroutine:
    >
    > If GetAsyncKeyState(vbLeftButton) Then
    > MsgBox "Left button clicked" '--example code
    > End If
    > and this detects the left mouse button.
    >
    > The problem is that I also have a function:
    > ListView1_ItemClick()
    > which detects a click on a ListView box and Windows(NT) gives priority to
    > GetAsyncKeyState() when the left mouse button is clicked and so clicking
    > on the ListView box no longer invokes ListView1_ItemClick().
    >
    > Is there a function which I can include which Windows will call when the
    > mouse clicks on a point outside my form (outside the control of my VB

    program)?
    > In other words, is there something like a "GetSystemFocus" function?
    >
    > Kenneth




  4. #4
    Kenneth Guest

    Re: Can you detect mose clicks by application/location?


    Thanks Johnathan, but I have since moved on to a different solution which
    invoves overloading a Windows function to trap the WM_ACTIVATEAPP message.
    The problem now is that I don't know the value (in hex) of WM_ACTIVATE_APP
    - does anyone know what it is ?


    "Jonathan Wood" <jwood@softcircuits.com> wrote:
    >If I understand the problem, you could probably use WindowFromPoint to find
    >out if the mouse is over your form. You'll need some sort of text for when
    >the mouse is over child windows of your form.
    >
    >--
    >Jonathan Wood
    >SoftCircuits Programming
    >http://www.softcircuits.com
    >"Kenneth" <keneth.berry@barco.com> wrote in message
    >news:3aefca24$1@news.devx.com...
    >>
    >> Hi
    >>
    >> I want to be able to differentiate between mouse clicks occuring outside
    >> my VB form and those occuring inside it. I have tried including the

    >following
    >> in a timer subroutine:
    >>
    >> If GetAsyncKeyState(vbLeftButton) Then
    >> MsgBox "Left button clicked" '--example code
    >> End If
    >> and this detects the left mouse button.
    >>
    >> The problem is that I also have a function:
    >> ListView1_ItemClick()
    >> which detects a click on a ListView box and Windows(NT) gives priority

    to
    >> GetAsyncKeyState() when the left mouse button is clicked and so clicking
    >> on the ListView box no longer invokes ListView1_ItemClick().
    >>
    >> Is there a function which I can include which Windows will call when the
    >> mouse clicks on a point outside my form (outside the control of my VB

    >program)?
    >> In other words, is there something like a "GetSystemFocus" function?
    >>
    >> Kenneth

    >
    >



  5. #5
    Kenneth Guest

    Re: Can you detect mose clicks by application/location?


    Thanks Johnathan, but I have since moved on to a different solution which
    invoves overloading a Windows function to trap the WM_ACTIVATEAPP message.
    The problem now is that I don't know the value (in hex) of WM_ACTIVATE_APP
    - does anyone know what it is ?


    "Jonathan Wood" <jwood@softcircuits.com> wrote:
    >If I understand the problem, you could probably use WindowFromPoint to find
    >out if the mouse is over your form. You'll need some sort of text for when
    >the mouse is over child windows of your form.
    >
    >--
    >Jonathan Wood
    >SoftCircuits Programming
    >http://www.softcircuits.com
    >"Kenneth" <keneth.berry@barco.com> wrote in message
    >news:3aefca24$1@news.devx.com...
    >>
    >> Hi
    >>
    >> I want to be able to differentiate between mouse clicks occuring outside
    >> my VB form and those occuring inside it. I have tried including the

    >following
    >> in a timer subroutine:
    >>
    >> If GetAsyncKeyState(vbLeftButton) Then
    >> MsgBox "Left button clicked" '--example code
    >> End If
    >> and this detects the left mouse button.
    >>
    >> The problem is that I also have a function:
    >> ListView1_ItemClick()
    >> which detects a click on a ListView box and Windows(NT) gives priority

    to
    >> GetAsyncKeyState() when the left mouse button is clicked and so clicking
    >> on the ListView box no longer invokes ListView1_ItemClick().
    >>
    >> Is there a function which I can include which Windows will call when the
    >> mouse clicks on a point outside my form (outside the control of my VB

    >program)?
    >> In other words, is there something like a "GetSystemFocus" function?
    >>
    >> Kenneth

    >
    >



  6. #6
    Michael Shutt Guest

    Re: Can you detect mose clicks by application/location?

    Private Const WM_ACTIVATEAPP = &H1C


    --
    Michael Shutt

    Please respond to newsgroup as I will not return direct emails.

    "Kenneth" <kenneth.berry@barco.com> wrote in message
    news:3af285f8$1@news.devx.com...
    >
    > Thanks Johnathan, but I have since moved on to a different solution which
    > invoves overloading a Windows function to trap the WM_ACTIVATEAPP message.
    > The problem now is that I don't know the value (in hex) of WM_ACTIVATE_APP
    > - does anyone know what it is ?
    >
    >
    > "Jonathan Wood" <jwood@softcircuits.com> wrote:
    > >If I understand the problem, you could probably use WindowFromPoint to

    find
    > >out if the mouse is over your form. You'll need some sort of text for

    when
    > >the mouse is over child windows of your form.
    > >
    > >--
    > >Jonathan Wood
    > >SoftCircuits Programming
    > >http://www.softcircuits.com
    > >"Kenneth" <keneth.berry@barco.com> wrote in message
    > >news:3aefca24$1@news.devx.com...
    > >>
    > >> Hi
    > >>
    > >> I want to be able to differentiate between mouse clicks occuring

    outside
    > >> my VB form and those occuring inside it. I have tried including the

    > >following
    > >> in a timer subroutine:
    > >>
    > >> If GetAsyncKeyState(vbLeftButton) Then
    > >> MsgBox "Left button clicked" '--example code
    > >> End If
    > >> and this detects the left mouse button.
    > >>
    > >> The problem is that I also have a function:
    > >> ListView1_ItemClick()
    > >> which detects a click on a ListView box and Windows(NT) gives priority

    > to
    > >> GetAsyncKeyState() when the left mouse button is clicked and so

    clicking
    > >> on the ListView box no longer invokes ListView1_ItemClick().
    > >>
    > >> Is there a function which I can include which Windows will call when

    the
    > >> mouse clicks on a point outside my form (outside the control of my VB

    > >program)?
    > >> In other words, is there something like a "GetSystemFocus" function?
    > >>
    > >> Kenneth

    > >
    > >

    >




  7. #7
    Michael Shutt Guest

    Re: Can you detect mose clicks by application/location?

    Private Const WM_ACTIVATEAPP = &H1C


    --
    Michael Shutt

    Please respond to newsgroup as I will not return direct emails.

    "Kenneth" <kenneth.berry@barco.com> wrote in message
    news:3af285f8$1@news.devx.com...
    >
    > Thanks Johnathan, but I have since moved on to a different solution which
    > invoves overloading a Windows function to trap the WM_ACTIVATEAPP message.
    > The problem now is that I don't know the value (in hex) of WM_ACTIVATE_APP
    > - does anyone know what it is ?
    >
    >
    > "Jonathan Wood" <jwood@softcircuits.com> wrote:
    > >If I understand the problem, you could probably use WindowFromPoint to

    find
    > >out if the mouse is over your form. You'll need some sort of text for

    when
    > >the mouse is over child windows of your form.
    > >
    > >--
    > >Jonathan Wood
    > >SoftCircuits Programming
    > >http://www.softcircuits.com
    > >"Kenneth" <keneth.berry@barco.com> wrote in message
    > >news:3aefca24$1@news.devx.com...
    > >>
    > >> Hi
    > >>
    > >> I want to be able to differentiate between mouse clicks occuring

    outside
    > >> my VB form and those occuring inside it. I have tried including the

    > >following
    > >> in a timer subroutine:
    > >>
    > >> If GetAsyncKeyState(vbLeftButton) Then
    > >> MsgBox "Left button clicked" '--example code
    > >> End If
    > >> and this detects the left mouse button.
    > >>
    > >> The problem is that I also have a function:
    > >> ListView1_ItemClick()
    > >> which detects a click on a ListView box and Windows(NT) gives priority

    > to
    > >> GetAsyncKeyState() when the left mouse button is clicked and so

    clicking
    > >> on the ListView box no longer invokes ListView1_ItemClick().
    > >>
    > >> Is there a function which I can include which Windows will call when

    the
    > >> mouse clicks on a point outside my form (outside the control of my VB

    > >program)?
    > >> In other words, is there something like a "GetSystemFocus" function?
    > >>
    > >> Kenneth

    > >
    > >

    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center