WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Dialog Editor version 6.X
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

AutoComplete in WinBatch Editboxes


Ow. I've banged my head against the Windows Platform SDK for a while, but not totally without reward. Here is a UDF to implement AutoComplete in WinBatch editboxes--it should work on Comboboxes, too, but I haven't tested it. Like Guido's most excellent Tooltip UDF's (that I blatantly plagarized in working on AutoComplete), this requires that you get the control number from RoboScripter (or assume that it is 99+control number). More information on AutoComplete can be found here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/shlwapi/version/shautocomplete.asp

;+-----AutoComplete Types-------------------------+
;|SHACF_AUTOSUGGEST_FORCE_ON  = 268435456         |
;|SHACF_AUTOSUGGEST_FORCE_OFF = 536870912         |
;|SHACF_AUTOAPPEND_FORCE_ON   = 1073741824        |
;|SHACF_AUTOAPPEND_FORCE_OFF  = -2147483648       |
;+-----AutoComplete Lists-------------------------|
;|SHACF_DEFAULT               = 0                 |
;|SHACF_FILESYSTEM            = 1                 |
;|SHACF_URLHISTORY            = 2                 |
;|SHACF_URLMRU                = 4                 |
;|SHACF_USETAB                = 8                 |
;|SHACF_FILESYS_ONLY          = 16                |
;+------------------------------------------------+
;|SHACF_URLALL = (SHACF_URLHISTORY | SHACF_URLMRU)|
;+------------------------------------------------+
 
;+-----Return Codes-------------------------------+
;|S_OK               = 0                          |
;|S_FALSE            = 1                          |
;|E_INVALIDARG       = -2147024809                |
;|E_OUTOFMEMORY      = -2147024882                |
;|E_UNEXPECTED       = -2147418113                |
;|RPC_E_CHANGED_MODE = -2147417850                |
;+------------------------------------------------+

#DefineFunction AutoComplete (DlgHandle,CtrlId,Flags)
CoInit=DllCall (StrCat(DirWindows(1),"Ole32.dll"),long:"CoInitialize",lpnull)
CtrlId=DllCall (StrCat(DirWindows(1),"User32.dll"),long:"GetDlgItem",long:DlgHandle,long:CtrlId)
RetVal=DllCall (StrCat(DirWindows(1),"SHLWAPI.dll"),long:"SHAutoComplete",long:CtrlId,long:Flags)
Return (0)
#EndFunction

#DefineSubRoutine DlgCallback (DlgName,DlgEvent,DlgCtrl,Res4,Res5)
If DlgEvent==00                                            ;Dialog initialization 
   DialogProcOptions (DlgName,02,1)                        ;Watch for button presses
   AutoComplete (DlgName,100,16|268435456)
   AutoComplete (DlgName,101,4|268435456)
   AutoComplete (DlgName,102,1|2|4|268435456)
EndIf
If DlgEvent==02                                            ;Button press event
   If DlgCtrl==004 Then Exit
EndIf
Return (-2)  
#EndFunction  

EditTestFormat=`WWWDLGED,6.1`
EditTestCaption=`Edit Box Autocomplete test`
EditTestX=145
EditTestY=056
EditTestWidth=162
EditTestHeight=086
EditTestNumControls=004
EditTestProcedure=`DlgCallback`
EditTestFont=`DEFAULT`
EditTestTextColor=`DEFAULT`
EditTestBackground=`DEFAULT,DEFAULT`
EditTestConfig=0
EditTest001=`011,009,136,012,EDITBOX,edtFileSys,"File System",DEFAULT,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
EditTest002=`011,027,136,012,EDITBOX,edtURLMRU,"Most Recent URLs",DEFAULT,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
EditTest003=`011,045,136,012,EDITBOX,edtEverything,"Everything",DEFAULT,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
EditTest004=`111,065,036,012,PUSHBUTTON,DEFAULT,"Cancel",0,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
ButtonPushed=Dialog("EditTest")
Exit

Article ID:   W15901
File Created: 2004:03:30:15:41:40
Last Updated: 2004:03:30:15:41:40