Link to home
Start Free TrialLog in
Avatar of RYMENHOUT
RYMENHOUT

asked on

label control and hwnd

is there a way to get the hwnd of a label control


i want to use the following api

GetClientRect  label.hwnd, lpRect
Avatar of mirtol
mirtol

A label has no window. It is printed on the parent's dc.

If u need to do something with it, use a text control.
Avatar of aikimark
Please delete your duplicate question.
mirtol is right

Info
Label is a windowless control just like
Line
Shape
Image
and the controls in the MSWLess.ocx shipped with VB6
Can you use the Form's hwnd and specify the size & location of the label directly from its properties?
Avatar of RYMENHOUT

ASKER

IT IS ON A USERCONTROL
ASKER CERTIFIED SOLUTION
Avatar of aikimark
aikimark
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Try with:
Private Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long

Private Sub Form_Load()
Dim r As RECT

With Label1
     r.Top = .Top
     r.Right = .Left + .Width
     r.Bottom = .Top + .Height
     r.Left = .Left
End With
GetWindowRect Me.hwnd, r
End Sub

Hi RYMENHOUT,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept aikimark's comment(s) as an answer.

RYMENHOUT, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange