-
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
-
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
-
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
-
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
>
>
-
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
>
>
-
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
> >
> >
>
-
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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks