Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (36 sloc) 1.16 KB
;=======================================================================================
;
; Function: CbAutoComplete
; Description: Auto-completes typed values in a ComboBox.
;
; Author: Pulover [Rodolfo U. Batista]
; Usage: Call the function from the Combobox's gLabel.
;
;=======================================================================================
CbAutoComplete()
{ ; CB_GETEDITSEL = 0x0140, CB_SETEDITSEL = 0x0142
If ((GetKeyState("Delete", "P")) || (GetKeyState("Backspace", "P")))
return
GuiControlGet, lHwnd, Hwnd, %A_GuiControl%
SendMessage, 0x0140, 0, 0,, ahk_id %lHwnd%
MakeShort(ErrorLevel, Start, End)
GuiControlGet, CurContent,, %lHwnd%
GuiControl, ChooseString, %A_GuiControl%, %CurContent%
If (ErrorLevel)
{
ControlSetText,, %CurContent%, ahk_id %lHwnd%
PostMessage, 0x0142, 0, MakeLong(Start, End),, ahk_id %lHwnd%
return
}
GuiControlGet, CurContent,, %lHwnd%
PostMessage, 0x0142, 0, MakeLong(Start, StrLen(CurContent)),, ahk_id %lHwnd%
}
MakeLong(LoWord, HiWord)
{
return (HiWord << 16) | (LoWord & 0xffff)
}
MakeShort(Long, ByRef LoWord, ByRef HiWord)
{
LoWord := Long & 0xffff
, HiWord := Long >> 16
}