Solved

label control and hwnd

Posted on 2002-05-15
9
1,220 Views
Last Modified: 2012-06-27
is there a way to get the hwnd of a label control


i want to use the following api

GetClientRect  label.hwnd, lpRect
0
Comment
Question by:RYMENHOUT
9 Comments
 
LVL 2

Expert Comment

by:mirtol
ID: 7010698
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
 
LVL 45

Expert Comment

by:aikimark
ID: 7010877
Please delete your duplicate question.
0
 
LVL 2

Expert Comment

by:corvanderlinden
ID: 7010943
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 45

Expert Comment

by:aikimark
ID: 7011006
Can you use the Form's hwnd and specify the size & location of the label directly from its properties?
0
 

Author Comment

by:RYMENHOUT
ID: 7011178
IT IS ON A USERCONTROL
0
 
LVL 45

Accepted Solution

by:
aikimark earned 50 total points
ID: 7011202
use the user control's hWnd and offset the label's position by the position of the user control's position.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7011575
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
 
LVL 49

Expert Comment

by:DanRollins
ID: 7765582
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
 

Expert Comment

by:SpideyMod
ID: 7838363
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question