Combo的自动查询技术
DeclareFunctionSendMessageLib"user32"Alias"SendMessageA"(ByVal hwndAsLong,ByValwMsgAsLong,ByValwParamAsLong,lParamAsAny) AsLong PublicConstCB_FINDSTRING=H14C PrivateSubCombo1_Change() DimiStartAsInteger DimsStringAsString StaticiLeftOffAsInt
DeclareFunctionSendMessageLib"user32"Alias"SendMessageA"(ByVal
hwndAsLong,ByValwMsgAsLong,ByValwParamAsLong,lParamAsAny)
AsLong
PublicConstCB_FINDSTRING=&H14C
PrivateSubCombo1_Change()
DimiStartAsInteger
DimsStringAsString
StaticiLeftOffAsInteger
iStart=1
iStart=Combo1.SelStart
IfiLeftOff<>0Then
Combo1.SelStart=iLeftOff
iStart=iLeftOff
EndIf
sString=CStr(Left(Combo1.Text,iStart))
Combo1.ListIndex=SendMessage(Combo1.hwnd,B_FINDSTRING,-1,ByValCStr(
Left(ombo1.Text,iStart)))
IfCombo1.ListIndex=-1Then
iLeftOff=Len(sString)
combo1.Text=sString
EndIf
Combo1.SelStart=iStart
iLeftOff=0
EndSub
静态变量iLeftOff指定了字符长度。->
hwndAsLong,ByValwMsgAsLong,ByValwParamAsLong,lParamAsAny)
AsLong
PublicConstCB_FINDSTRING=&H14C
PrivateSubCombo1_Change()
DimiStartAsInteger
DimsStringAsString
StaticiLeftOffAsInteger
iStart=1
iStart=Combo1.SelStart
IfiLeftOff<>0Then
Combo1.SelStart=iLeftOff
iStart=iLeftOff
EndIf
sString=CStr(Left(Combo1.Text,iStart))
Combo1.ListIndex=SendMessage(Combo1.hwnd,B_FINDSTRING,-1,ByValCStr(
Left(ombo1.Text,iStart)))
IfCombo1.ListIndex=-1Then
iLeftOff=Len(sString)
combo1.Text=sString
EndIf
Combo1.SelStart=iStart
iLeftOff=0
EndSub
静态变量iLeftOff指定了字符长度。->
- 上一篇:五彩缤纷的清屏效果
- 下一篇:应用VB4.0实现工业控制的实时曲线和历史曲线
精彩图集
精彩文章