Combobox控件 致 VB软件无任何提示,强行关闭
VB combobox 有一个窗体里面的的Combobox控件,当我选择完项目或单击后,到其他控件点了,再回来点第二次,,VB系统会无任何提示,强行关闭。在VB 6.0 里面调试也没有找出来,也是没有任何提示。 我试着换了1.0 或 2.0的Combobox 控件,也存在同样的问题。 但是在同一窗体里面的其他COMBOBOX控件,没有此类型的错误。该控件只调用了 如下模块(get focus 和 lost focus 命令):
Option Explicit
Public Cn As New ADODB.Connection
Public Const GWL_WNDPROC = (-4)
Public Const WM_COMMAND = &H111
Public Const WM_MBUTTONDOWN = &H207
Public Const WM_MBUTTONUP = &H208
Public Const WM_MOUSEWHEEL = &H20A
Public Oldwinproc As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, _
ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long) As Long
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Function FlexScroll(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
''支持鼠标动作
Select Case wMsg
Case WM_MOUSEWHEEL
Select Case wParam
Case -7864320 ''向下
SendKeys "{PGDN}"
Case 7864320 ''向上
SendKeys "{PGUP}"
End Select
End Select
FlexScroll = CallWindowProc(Oldwinproc, hwnd, wMsg, wParam, lParam)
End Function
但是其他COMBOBOX 也有同样的调用,也没有出现这样的错误,请问大家,这是什么原因呢。谢谢了。
[解决办法]
CallWindowProc(Oldwinproc, hwnd, wMsg, wParam, lParam)
这个用错了吧,仔细检查下
虽然你说是在操作Combobox时出的错 但错不一定就真的在Combobox