|
-
Aug 13th, 2000, 04:18 PM
#1
Thread Starter
New Member
I am developing an ActiveX control. And for some of the functions that i wish to perform, i need to know the location of the usercontrol form WITH RESPECT TO THE SCREEN. i mean like not w.r.t to its parent or anthing, but i need to know the position of the control w.r.t the screen itself. I realize that there are no Ambient properties that expose this. is there a way around using API?
Actually , let my try to put it more clearly. I have a textbox in a usercontrol. Is there a method or an API through which i can learn the position or coordinates of the textbox with respect to (0,0) of the desktop ? the .top and .left aren't of much use because they return the position with respect to their parent controls. Is there a way around ?
Thanks a lot in advance,
Genie
If its too good to be true, it probably isn't
-
Aug 13th, 2000, 04:35 PM
#2
Fanatic Member
try adding the parent forms top and left to the text box top and left.
GWDASH
[b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]
-
Aug 13th, 2000, 04:45 PM
#3
Thread Starter
New Member
yup..
Yeah.. been there.. tried that.. doesn't work...
thanks ne wayz..
If its too good to be true, it probably isn't
-
Aug 13th, 2000, 04:45 PM
#4
Frenzied Member
the GetWindowRect API will get the Controlls position on the screen in pixels. Adding the parents position to the usercontrols position gets a bit tricky with scalemodes and just doesn't work if the usercontol is in a frame, picturebox or MDI child form try this
Code:
Private Type RECTL
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function GetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Function GetPosition (hWnd As Long) As RECT
dim retval As RECT
Call GetWindowRect9hWnd,retval)
GetPosition = retval
End Function
The RECT UDT returned by this will Contain all the info about the window in pixels
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
|
Click Here to Expand Forum to Full Width
|