K
Kenan
Public Declare Function GetFocus Lib "Coredll" () As
Integer
Public Declare Function GetWindowLong Lib "Coredll"
Alias "GetWindowLongW" (ByVal hwnd As Integer, ByVal
nIndex As Integer) As Integer
Public Declare Function SetWindowLong Lib "Coredll"
Alias "SetWindowLongW" (ByVal hwnd As Integer, ByVal
nIndex As Integer, ByVal dwNewLong As Integer) As Integer
Const GWL_STYLE = -16
Const ES_NUMBER = 8192
Const ES_UPPERCASE = 8
Const ES_LOWERCASE = 16
Public Function EnsureNumeric(ByVal pTextBox As
TextBox, ByVal Force As Boolean)
Dim hWnd As Integer
Dim Style As Integer
Try
pTextBox.Focus()
hWnd = GetFocus
Style = GetWindowLong(hWnd, GWL_STYLE)
If Force Then
Style = Style Or ES_NUMBER
Else
Style = Style And Not ES_NUMBER
End If
SetWindowLong(hWnd, GWL_STYLE, Style)
Catch
End Try
End Function
Public Function EnsureUpperCase(ByVal pTextBox As
TextBox)
Dim hWnd As Integer
Dim Style As Integer
pTextBox.Focus()
hWnd = GetFocus
Style = GetWindowLong(hWnd, GWL_STYLE)
Style = Style Or ES_UPPERCASE
SetWindowLong(hWnd, GWL_STYLE, Style)
End Function
Integer
Public Declare Function GetWindowLong Lib "Coredll"
Alias "GetWindowLongW" (ByVal hwnd As Integer, ByVal
nIndex As Integer) As Integer
Public Declare Function SetWindowLong Lib "Coredll"
Alias "SetWindowLongW" (ByVal hwnd As Integer, ByVal
nIndex As Integer, ByVal dwNewLong As Integer) As Integer
Const GWL_STYLE = -16
Const ES_NUMBER = 8192
Const ES_UPPERCASE = 8
Const ES_LOWERCASE = 16
Public Function EnsureNumeric(ByVal pTextBox As
TextBox, ByVal Force As Boolean)
Dim hWnd As Integer
Dim Style As Integer
Try
pTextBox.Focus()
hWnd = GetFocus
Style = GetWindowLong(hWnd, GWL_STYLE)
If Force Then
Style = Style Or ES_NUMBER
Else
Style = Style And Not ES_NUMBER
End If
SetWindowLong(hWnd, GWL_STYLE, Style)
Catch
End Try
End Function
Public Function EnsureUpperCase(ByVal pTextBox As
TextBox)
Dim hWnd As Integer
Dim Style As Integer
pTextBox.Focus()
hWnd = GetFocus
Style = GetWindowLong(hWnd, GWL_STYLE)
Style = Style Or ES_UPPERCASE
SetWindowLong(hWnd, GWL_STYLE, Style)
End Function