?
Solved

label control and hwnd

Posted on 2002-05-15
9
Medium Priority
?
1,262 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 46

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 46

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 46

Accepted Solution

by:
aikimark earned 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month13 days, 13 hours left to enroll

800 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