how can i find the hWnd of the label control?
Printable View
how can i find the hWnd of the label control?
Unless you use VB 4.0 or earlier, labels are not windows - they don't have a hWnd. They are a static or graphical control, not window-based.
how about checkbox and option box?
ActiveX controls almost always have a hWnd, intrinsic VB controls probably do. Before you ask about every control in VB, use the Object Browser to find out for yourself.
Look up a a control in the Browser, like Label, you'll see it has no .hWnd property. While this is not a guarantee the object has no hWnd, it's an indicator. Check Box & option button controls do have a hWnd property.
everything has a hWnd... but not always as a property.... u'll have to use FindWindow and FindWindowEx functions....
You can also use EnumChildWindows APi call
Albafa - according to MSDN VB6.0 label controls are not windows, they have no hWnd. Spy++ agrees. If you know differently on an absolute basis, please demonstrate.
And, you folks are right - almost all controls have a hWnd, even if it doesn't show in properties.
omg jim ur right :p ... i never noticed that :( shrugs
Guess I was just too used to reading from AOL's "static" labels..
Quote:
Originally posted by FLasH3r
how about checkbox and option box?
VB Code:
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long Private Sub Command1_Click() SetWindowText FindWindowEx(Me.hwnd, 0, "ThunderCheckBox", vbNullString), "Hello" End Sub