At Dev Avish's site, I found code to align the tops of two forms,
(www.mvps.org/access/forms/frm0042.htm) but I can't figure out how to
adapt this code to my purposes.
--
TIA,
Randy Shore
Data Design
805.494.3439
Sent via Deja.com http://www.deja.com/
Before you buy.
You can use a call to the GetCursorPos API function to retrieve the mouse.
You'll first need to declare the point coordinate type used by the API call
then declare the function call itself. You'll also need to declare the
ScreenToClient API call since GetCursorPos returns a position in the screen
coordinate system, which you'll have to convert to the Access MDI window
coordinate system before moving your form:
Public Type POINTAPI 'used for GetCursorPos API function
x As Long
y As Long
End Type
Public Declare Function apiGetCursorPos Lib "user32" Alias "GetCursorPos"
(lpPoint As POINTAPI) As Long
Public Declare Function apiScreenToClient Lib "user32" Alias
"ScreenToClient" (ByVal hWnd As Long, lpPoint As POINTAPI) As Long
The simplest example of moving a form to the mouse coordinates would involve
the following restrictions:
1. Move the upper left corner to the current mouse position (as opposed to
some prior mouse position).
2. Ignore the fact that positioning the form in this way might cause all or
part of the form to be positioned outside the current Access window
rectangle.
The following function will accomplish this task:
Public Sub MoveFormToMouse(ByVal frmToMove As Form)
Dim fwToMove As clFormWindow
Dim ptCursor As POINTAPI
apiGetCursorPos ptCursor
Set fwToMove = New clFormWindow
With fwToMove
.hWnd = frmToMove.hWnd
apiScreenToClient .Parent.hWnd, ptCursor
.Left = ptCursor.x
.Top = ptCursor.y
End With
Set fwToMove = Nothing
End Sub
HTH,
Nicole
"Randy at Data Design" <vtas...@my-deja.com> wrote in message
news:835mif$5lv$1...@nnrp1.deja.com...
Thanks! It worked great.
--
Regards,
Randy Shore
Data Design
805.494.3439
In article <uZVK9zqR$GA.255@cppssbbsa04>,