Solved

label control and hwnd

Posted on 2002-05-15
9
1,231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

734 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