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
RYMENHOUTAsked:
Who is Participating?
 
aikimarkConnect With a Mentor Commented:
use the user control's hWnd and offset the label's position by the position of the user control's position.
0
 
mirtolCommented:
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.
0
 
aikimarkCommented:
Please delete your duplicate question.
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
corvanderlindenCommented:
mirtol is right

Info
Label is a windowless control just like
Line
Shape
Image
and the controls in the MSWLess.ocx shipped with VB6
0
 
aikimarkCommented:
Can you use the Form's hwnd and specify the size & location of the label directly from its properties?
0
 
RYMENHOUTAuthor Commented:
IT IS ON A USERCONTROL
0
 
Richie_SimonettiIT OperationsCommented:
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

0
 
DanRollinsCommented:
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
0
 
SpideyModCommented:
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.