It doesn't exist, but is there a way around it???? I need that hwnd!!!
Printable View
It doesn't exist, but is there a way around it???? I need that hwnd!!!
You are absolutely right, there isn't a hwnd, and the reason is because there isnt'. In other words, a label doesn't have a hwnd.
In fact the caption is written directly on the form so there isn't a window to which it could have a handle
I know there is no hwnd for label. I'm asking if there is a way around it (I need to use the label in subclassing but without the hwnd it's not possible)
P.S. What with that caption????? What caption?????
Why exactly do you need it for.
There are more than two ways to get deep pe...
I've said too much.
I need to create a mouse_in and mouse_out event. I did it with command button, picture box, form, frame etc. But all of them had the hwnd. I have a bunch of labels (a lot actually) and I need to create a mouse_in and out event. Without the hwnd - well it's not doable.
Could you set the Label1.tag = 333
or whatever and access the label by its tag number?
He is using it for subclassing, I dont think you can use the Tag property in subclassing... unfortunatly :(
Make a usercontrol that acts like a label, but is a windowed control.
HeSaidJoe: Can't do. In my subclassing procedure I have something like this:
the hwnd is part of the subclassing (as far as I know you need to have hwnd to subclass unless I'm mistaken). So as you see I need that [beep] hwndCode:Select Case hwnd
Case frmMain.hwnd
Case frmOption.hwnd
Case frmMain.cmdAdd.hwnd
End Select
The UserControl has the capability to export its hWnd.
Don't know if it's of any use to you but I found this on
another site as an answer to finding the hwnd can't be found
'sample of mouse over mouse off
It might give you a spark or something and if not...just more useless code for your situtation.
[code]
Private Sub Form_Load()
Picture1.Height = 1
Picture1.Width = 1
End Sub
Private Sub Label1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
If State = 1 Then
lblmsg = "Mouse left label1"
Picture1.Drag 0
End If
End Sub
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
lblmsg = "Mouse is over label1"
Picture1.Left = Label1.Left + X
Picture1.Top = Label1.Top + Y
Picture1.Drag
End Sub
[code]
I think you could have a textbox to act like a label if you remove the borders, or ofcouse you could make a usercontrol for that
Why not just place it in a PictureBox?
because it would take up more resource than a textbox would