Hi all,
My development environment is VB 6.0, and my OS is winxp. I would like to know how to find the mouse location at a control when the mouse is point at that control. The problem is that the mouse "whatever" events will not fire since the mouse is hjhack by other control. Anyway, I have the following code and I can check is the mouse over the control or not, however, I cannot find out where the mouse location at that control.
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
private sub mouseChecker()
Dim pnt As POINTAPI
Dim ConvertX As Double
GetCursorPos pnt
If WindowFromPoint(pnt.x, pnt.y) = Me.control1.hWnd Then
'I cannot find any method in finding the mouse location in that Visual basic control.
End If
end sub
thanks
Egghead 5 7764
--
Thanks
Robert Lo
Application Developer
LogTech Canada Ltd
660, 10201 Southport Road S.W.
Calgary, Alberta
Canada T2W 4X9
Email: ro*******@logtechcanada.com
"EggHead" <ro**************@shaw.cawrote in message news:GH4th.773721$1T2.555065@pd7urf2no...
Hi all,
My development environment is VB 6.0, and my OS is winxp. I would like to know how to find the mouse location at a control when the mouse is point at that control. The problem is that the mouse "whatever" events will not fire since the mouse is hjhack by other control. Anyway, I have the following code and I can check is the mouse over the control or not, however, I cannot find out where the mouse location at that control.
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
private sub mouseChecker()
Dim pnt As POINTAPI
Dim ConvertX As Double
GetCursorPos pnt
If WindowFromPoint(pnt.x, pnt.y) = Me.control1.hWnd Then
'I cannot find any method in finding the mouse location in that Visual basic control.
End If
end sub
thanks
Egghead
On Mon, 22 Jan 2007 15:25:26 GMT, "EggHead" <ro**************@shaw.ca>
wrote:
>This is a multi-part message in MIME format.
------=_NextPart_000_0010_01C73DFE.D4179010 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi all,
My development environment is VB 6.0, and my OS is winxp. I would like = to know how to find the mouse location at a control when the mouse is = point at that control. The problem is that the mouse "whatever" events = will not fire since the mouse is hjhack by other control. Anyway, I have = the following code and I can check is the mouse over the control or not, = however, I cannot find out where the mouse location at that control.
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) = As Long Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As = Long, ByVal yPoint As Long) As Long
private sub mouseChecker()
Dim pnt As POINTAPI
Dim ConvertX As Double
GetCursorPos pnt
If WindowFromPoint(pnt.x, pnt.y) =3D Me.control1.hWnd Then
'I cannot find any method in finding the mouse location in that =
Look at the ScreenToClient API
It converts a Point structure from screen coordinates to client
coordinates
In response to the post:
On Mon, 22 Jan 2007 15:25:26 GMT, "EggHead"
<ro**************@shaw.castated...and I replied:
>Hi all,
My development environment is VB 6.0, and my OS is winxp. I would like to know how to find the mouse location at a control when the mouse is point at that control. The problem is that the mouse "whatever" events will not fire since the mouse is hjhack by other control. Anyway, I have the following code and I can check is the mouse over the control or not, however, I cannot find out where the mouse location at that control.
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
private sub mouseChecker()
Dim pnt As POINTAPI
Dim ConvertX As Double
GetCursorPos pnt
If WindowFromPoint(pnt.x, pnt.y) = Me.control1.hWnd Then
'I cannot find any method in finding the mouse location in that Visual basic control.
End If end sub thanks Egghead
Try this (air code)
'begin code
Type POINTAPI
X As Long
Y As Long
End Type
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Type WINDOWPLACEMENT
Length As Long
flags As Long
ShowCmd As Long
ptMinPosition As POINTAPI
ptMaxPosition As POINTAPI
rcNormalPosition As RECT
End Type
Declare Function GetCursorPos Lib "user32" ( _
lpPoint As POINTAPI) As Long
Declare Function GetWindowPlacement Lib "user32" ( _
ByVal hwnd As Long, _
lpwndpl As WINDOWPLACEMENT) As Long
Public Function PointsToMe() As Boolean
Dim WinPos As WINDOWPLACEMENT
Dim Point As POINTAPI, lResult As Long
lResult = GetCursorPos(Point)
lResult = GetWindowPlacement(Me.hwnd, WinPos)
If Point.X >= WinPos.rcNormalPosition.Left And _
Point.X <= WinPos.rcNormalPosition.Right And _
Point.Y >= WinPos.rcNormalPosition.Top And _
Point.Y <= WinPos.rcNormalPosition.Bottom Then _
PointsToMe = True
End Function
'end air code
Shell wrote:
In response to the post:
On Mon, 22 Jan 2007 15:25:26 GMT, "EggHead"
<ro**************@shaw.castated...and I replied:
>Hi all,
My development environment is VB 6.0, and my OS is winxp. I would like to know how to find the mouse location at a control when the mouse is point at that control. The problem is that the mouse "whatever" events will not fire since the mouse is hjhack by other control. Anyway, I have the following code and I can check is the mouse over the control or not, however, I cannot find out where the mouse location at that control.
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
private sub mouseChecker() Dim pnt As POINTAPI Dim ConvertX As Double GetCursorPos pnt If WindowFromPoint(pnt.x, pnt.y) = Me.control1.hWnd Then 'I cannot find any method in finding the mouse location in that Visual basic control.
End If end sub thanks Egghead
Try this (air code)
'begin code
Type POINTAPI
X As Long
Y As Long
End Type
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Type WINDOWPLACEMENT
Length As Long
flags As Long
ShowCmd As Long
ptMinPosition As POINTAPI
ptMaxPosition As POINTAPI
rcNormalPosition As RECT
End Type
Declare Function GetCursorPos Lib "user32" ( _
lpPoint As POINTAPI) As Long
Declare Function GetWindowPlacement Lib "user32" ( _
ByVal hwnd As Long, _
lpwndpl As WINDOWPLACEMENT) As Long
Public Function PointsToMe() As Boolean
Dim WinPos As WINDOWPLACEMENT
Dim Point As POINTAPI, lResult As Long
lResult = GetCursorPos(Point)
lResult = GetWindowPlacement(Me.hwnd, WinPos)
If Point.X >= WinPos.rcNormalPosition.Left And _
Point.X <= WinPos.rcNormalPosition.Right And _
Point.Y >= WinPos.rcNormalPosition.Top And _
Point.Y <= WinPos.rcNormalPosition.Bottom Then _
PointsToMe = True
End Function
'end air code
Bare in mind that this will also return true if the OPs window is not on
top.
To Egghead (why can't people use sensible names?):
What is it that has captured the mouse as it is broken...
--
Dean Earley (de*********@icode.co.uk)
i-Catcher Development Team
iCode Systems
Hi all,
using this API "GetWindowRect", I found it is very easy.
The mouse event is not broken. It is because other control has the mouse
event
cheers,
Egghead
"Shell" <dr*****@mindspring.comwrote in message
news:sm********************************@4ax.com...
In response to the post:
On Mon, 22 Jan 2007 15:25:26 GMT, "EggHead"
<ro**************@shaw.castated...and I replied:
>>Hi all,
My development environment is VB 6.0, and my OS is winxp. I would like to know how to find the mouse location at a control when the mouse is point at that control. The problem is that the mouse "whatever" events will not fire since the mouse is hjhack by other control. Anyway, I have the following code and I can check is the mouse over the control or not, however, I cannot find out where the mouse location at that control.
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
private sub mouseChecker() Dim pnt As POINTAPI Dim ConvertX As Double GetCursorPos pnt If WindowFromPoint(pnt.x, pnt.y) = Me.control1.hWnd Then 'I cannot find any method in finding the mouse location in that Visual basic control.
End If end sub thanks Egghead
Try this (air code)
'begin code
Type POINTAPI
X As Long
Y As Long
End Type
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Type WINDOWPLACEMENT
Length As Long
flags As Long
ShowCmd As Long
ptMinPosition As POINTAPI
ptMaxPosition As POINTAPI
rcNormalPosition As RECT
End Type
Declare Function GetCursorPos Lib "user32" ( _
lpPoint As POINTAPI) As Long
Declare Function GetWindowPlacement Lib "user32" ( _
ByVal hwnd As Long, _
lpwndpl As WINDOWPLACEMENT) As Long
Public Function PointsToMe() As Boolean
Dim WinPos As WINDOWPLACEMENT
Dim Point As POINTAPI, lResult As Long
lResult = GetCursorPos(Point)
lResult = GetWindowPlacement(Me.hwnd, WinPos)
If Point.X >= WinPos.rcNormalPosition.Left And _
Point.X <= WinPos.rcNormalPosition.Right And _
Point.Y >= WinPos.rcNormalPosition.Top And _
Point.Y <= WinPos.rcNormalPosition.Bottom Then _
PointsToMe = True
End Function
'end air code This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jay |
last post by:
I need to be able to move a Panel on a windows Form at run time using
the mouse. I have tried adding a MouseDown event handler to the Panel
and then within the MouseDown handler adding a MouseMove...
|
by: Robin Senior |
last post by:
Hi,
I'm trying to drag and drop onto a Panel on my form. The panel is inside
a groupBox, which of course is inside my form.
When dropping the item onto my Panel, I want it to appear at that...
|
by: Raj Chudasama |
last post by:
I have a controls similiar to the windows calculator. (Please press some
buttons on your calculator to see what i am talking about)
So when u hover over a button it will change the state (it...
|
by: Charles Law |
last post by:
Sorry for reposting this question, but I did not get a single answer last
time, and I'm sure you guys must have some thoughts on the matter.
I have a user control which can be dragged and dropped...
|
by: jcrouse |
last post by:
I have created a form designer type application (with a lot of you peoples
helpJ). It has label controls that are draggable at runtime. The user is
also allowed to change some properties such as...
|
by: Lars Netzel |
last post by:
Hi!
I have a round area which I want to be able to move the mouse over and fire
off events... how do I do that?
I have drawn a FillPie Graphics and I feel that there has to be a way of...
|
by: Sam |
last post by:
Hi,
I can't figure out how to detect when my mouse cursor leaves a panel
control. It should not trigger the event (or do anything) when the
mouse leave the panel but still is over a control that...
|
by: beatsoup |
last post by:
Is there a way to find out the location of the mouse when an event
object is not handy? For example, let's say I want to wake up in 1
second and check where the mouse is. The function called by the...
|
by: quickcur |
last post by:
Hi, I have html like this:
<div id="myCanvas" style="border:10px,
black;position:relative;height:250px;width:100%;">
<img id="p" src="p.jpg">
</div>
When user click the mosue, I would like
...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |