Postup:
Deklarujte:
Private Declare Function
GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) _
As Long
Private Declare Function
SetWindowLong Lib "user32" Alias _
"SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Sub ForceTextBoxCase(TextBox
As TextBox, Optional ConvertCase _
As Integer)
Dim style As Long
Const GWL_STYLE = (-16)
Const ES_UPPERCASE = &H8&
Const ES_LOWERCASE = &H10&
'
zjiÜt∞nφ aktußlnφho stylu
style
= GetWindowLong(TextBox.hWnd, GWL_STYLE)
Select
Case ConvertCase
Case
0
'
obnovenφ p∙vodnφho stylu
style
= style And Not (ES_UPPERCASE Or ES_LOWERCASE)
Case
1
'
p°evod na velkß pφsmena
style
= style Or ES_UPPERCASE
Case
2
'
p°evod na malß pφsmena
style
= style Or ES_LOWERCASE
End
Select
'
zavedenφ novΘho stylu
SetWindowLong
TextBox.hWnd, GWL_STYLE, style
End Sub
|