错误地点有二。 1。 a = SetWindowPos(Me.hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE Or SWP_NOZORDER Or SWP_FRAMECHANGED) 为LIST1。HWND 2。必须发送相关风格
MSVCer(我他妈还不如去筛沙呢) 说的对,但在VB中不用。
'This project needs a TextBox 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 Const GWL_STYLE = (-16) Const ES_NUMBER = &H2000& Public Sub SetNumber(NumberText As TextBox, Flag As Boolean) Dim curstyle As Long, newstyle As Long 'retrieve the window style curstyle = GetWindowLong(NumberText.hwnd, GWL_STYLE) If Flag Then curstyle = curstyle Or ES_NUMBER Else curstyle = curstyle And (Not ES_NUMBER) End If 'Set the new style newstyle = SetWindowLong(NumberText.hwnd, GWL_STYLE, curstyle) 'refresh NumberText.Refresh End Sub Private Sub Form_Load() 'KPD-Team 1999 'URL: http://www.allapi.net/ 'E-Mail: [email protected]
SetNumber Text1, True Me.Caption = "Now, try typing some letters into the textbox" End Sub
但没有用。
1。
a = SetWindowPos(Me.hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE Or SWP_NOZORDER Or SWP_FRAMECHANGED)
为LIST1。HWND
2。必须发送相关风格
说的对,但在VB中不用。
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
Const GWL_STYLE = (-16)
Const ES_NUMBER = &H2000&
Public Sub SetNumber(NumberText As TextBox, Flag As Boolean)
Dim curstyle As Long, newstyle As Long 'retrieve the window style
curstyle = GetWindowLong(NumberText.hwnd, GWL_STYLE) If Flag Then
curstyle = curstyle Or ES_NUMBER
Else
curstyle = curstyle And (Not ES_NUMBER)
End If 'Set the new style
newstyle = SetWindowLong(NumberText.hwnd, GWL_STYLE, curstyle)
'refresh
NumberText.Refresh
End Sub
Private Sub Form_Load()
'KPD-Team 1999
'URL: http://www.allapi.net/
'E-Mail: [email protected]
SetNumber Text1, True
Me.Caption = "Now, try typing some letters into the textbox"
End Sub