Brett Barabash
BBarabash at TappeConstruction.com
Fri Sep 19 08:48:35 CDT 2003
You need to use the GetCursorPos API call: Private Type POINTAPI x As Long y As Long End Type Private Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (lpPoint As POINTAPI) As Long Dim typPA AS POINTAPI GetCursorPos typPA Debug.Print typPA.x, typPA.y The results are in pixels, so to convert to twips you need to use the GetDeviceCaps API call: Private Const cTwipsPerInch = 1440 Private Const LOGPIXELSX = 88 ' Logical pixels/inch in X Private Const LOGPIXELSY = 90 ' Logical pixels/inch in Y Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long Public Function XPixelsToTwips(ByVal lngX As Long) As Long XPixelsToTwips = lngX * (cTwipsPerInch / GetDeviceCaps(GetDC(0), LOGPIXELSX)) End Function Public Function YPixelsToTwips(ByVal lngY As Long) As Long YPixelsToTwips = lngY * (cTwipsPerInch / GetDeviceCaps(GetDC(0), LOGPIXELSY)) End Function -----Original Message----- From: Erwin Craps [mailto:Erwin.Craps at ithelps.be] Sent: Friday, September 19, 2003 7:58 AM To: Access Developers discussion and problem solving Subject: [AccessD] Screen position of mouse. I can't find how to know the postition of the mouse on the screen. I have a pop-up form I want to pop-up at the same place as where the mouse cursor is at that time. So I want to put put the code in the on_open event of the pop-up form in question lngMouseLeft = ???.Left lngMouseTop = ???.Top me.move lngMouseLeft, lngMouseTop Thx Erwin Craps Zaakvoerder www.ithelps.be/jonathan <http://www.ithelps.be/jonathan> This E-mail is confidential, may be legally privileged, and is for the intended recipient only. Access, disclosure, copying, distribution, or reliance on any of it by anyone else is prohibited and may be a criminal offence. Please delete if obtained in error and E-mail confirmation to the sender. IT Helps - I.T. Help Center *** Box Office Belgium & Luxembourg www.ithelps.be <http://www.ithelps.be/> * www.boxoffice.be <http://www.boxoffice.be/> * <http://www.stadleuven.be/> www.stadleuven.be IT Helps bvba* ** Mercatorpad 3 ** 3000 Leuven IT Helps * Phone: +32 16 296 404 * Fax: +32 16 296 405 E-mail: Info at ithelps.be <mailto:Info at ithelps.be> Box Office ** Fax: +32 16 296 406 ** Box Office E-mail: <mailto:figures at boxoffice.be> Staff at boxoffice.be -------------------------------------------------------------------------------------------------------------------- This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the originator of the message. This footer also confirms that this email message has been scanned for the presence of computer viruses. Any views expressed in this message are those of the individual sender, except where the sender specifies and with authority, states them to be the views of Tappe Construction Co. Scanning of this message and addition of this footer is performed by SurfControl E-mail Filter software in conjunction with virus detection software. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030919/f5e8c8be/attachment-0001.html>